Not responding
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Not responding
I have a stack that creates 10 files of 100KB each, and it counts up 1% for each file (it would be 100 files in the end, but for testing purposes I'm just creating 10 files) - when it gets to 4% it says "not responding" in livecode and as standalone, but then it finish in a few seconds.
Is there any way I can get the "not responding" from Windows to not show up? - Is there a way I can let Windows know that the program is busy doing stuff?
Thanks,
Carel
Is there any way I can get the "not responding" from Windows to not show up? - Is there a way I can let Windows know that the program is busy doing stuff?
Thanks,
Carel
Re: Not responding
In the repeat loop, include a lineThis gives the engine a moment of as near zero duration as can be, but which allows for updating screen, keyboard polling and generally interacting with the operating system. That should be enough to let the app appear responsive.
Code: Select all
wait 0 milliseconds with messages
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Not responding
Yep, like sparkout says, if you max out the LiveCode engine doing something then your OS can slap a 'non Responsive' label onto your app.
Using 'wait 0 with messages' is a great way of allowing things to progress in such situations - but it can also be worth checking your code and seeing if there is anything you could do to help things along - for example don't work with data in fields (put data in variables or arrays and make changes there, only at the end exporting back to fields/lists/datagrids), lock the screen to prevent unnecessary updates, use 'repeat for' when possible instead of 'repeat with' etc etc
Kind regards
Dave
Using 'wait 0 with messages' is a great way of allowing things to progress in such situations - but it can also be worth checking your code and seeing if there is anything you could do to help things along - for example don't work with data in fields (put data in variables or arrays and make changes there, only at the end exporting back to fields/lists/datagrids), lock the screen to prevent unnecessary updates, use 'repeat for' when possible instead of 'repeat with' etc etc
Kind regards
Dave
"...this is not the code you are looking for..."
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Not responding
A recent thread here is a very good example of both performance optimization and community participation, in which many members here iteratively improved a particular lookup algo bringing the processing time from 9 minutes down to ever-smaller fractions of seconds, ultimately down to 3 milliseconds - a long three-page read but worth the time:dave.kilroy wrote:... it can also be worth checking your code and seeing if there is anything you could do to help things along - for example don't work with data in fields (put data in variables or arrays and make changes there, only at the end exporting back to fields/lists/datagrids), lock the screen to prevent unnecessary updates, use 'repeat for' when possible instead of 'repeat with' etc etc
http://forums.livecode.com/viewtopic.php?f=8&t=24945
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Not responding
Thanks everyone, the not responding is now not showing up, but it still takes a few minutes to create one file of approximately 1MB
any way to speed this up?
Thanks,
Carel
command createFiles
answer "creating files"
put 0 into myPercentage
set the label of button "installStatus" on card install to "Creating protection files" & " " & myPercentage & "%"
repeat 10 times -- this will eventually be 100
put "zz" into myRandomString
wait 0 milliseconds with messages
repeat 10 times
put myRandomString & random(9) into myRandomString
wait 0 milliseconds with messages
end repeat
repeat 1000000 times --this is creating the file
wait 0 milliseconds with messages
put myDummyString & "a" into myDummyString
end repeat
put gInstallFolder & "/" & myRandomString & ".doc" into gMyFileName
put myDummyString into url("file:" & gMyFileName)
add 1 to myPercentage
set the label of button "installStatus" on card install to "Creating protection files" & " " & myPercentage & "%"
end repeat --100 times
answer "done"
end createFiles
any way to speed this up?
Thanks,
Carel
command createFiles
answer "creating files"
put 0 into myPercentage
set the label of button "installStatus" on card install to "Creating protection files" & " " & myPercentage & "%"
repeat 10 times -- this will eventually be 100
put "zz" into myRandomString
wait 0 milliseconds with messages
repeat 10 times
put myRandomString & random(9) into myRandomString
wait 0 milliseconds with messages
end repeat
repeat 1000000 times --this is creating the file
wait 0 milliseconds with messages
put myDummyString & "a" into myDummyString
end repeat
put gInstallFolder & "/" & myRandomString & ".doc" into gMyFileName
put myDummyString into url("file:" & gMyFileName)
add 1 to myPercentage
set the label of button "installStatus" on card install to "Creating protection files" & " " & myPercentage & "%"
end repeat --100 times
answer "done"
end createFiles
Re: Not responding
The processes within LC are not linear:
100,000 passes, 124 ticks
But changing to 1,000,000 interations takes 42,000 ticks.
If you just have:
then 1,000,0000 passes only takes 124 ticks. So can you eliminate function calls within your 100,0000,0000 iteration nested loops?
Craig Newman
Code: Select all
command createFiles
put "K" into myRandomString
put the ticks into xx
repeat 100000
put myRandomString & random(9) into myRandomString
end repeat
answer the ticks - xx
end createFiles
But changing to 1,000,000 interations takes 42,000 ticks.
If you just have:
Code: Select all
command createFiles
put "K" into myRandomString
put the ticks into xx
repeat 1000000
put myRandomString & into myRandomString
end repeat
answer the ticks - xx
end createFiles
Craig Newman
Last edited by dunbarx on Mon Aug 10, 2015 4:38 am, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Not responding
Given the code in the fifth post here, are the output files sizes what you would expect?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn