Hi there,
so here's my problem. Basically I'm loading some data from a file and storing it in a local var 'dbFile'. I then cycle through that data taking sixteen bytes at a time.
I then convert those bytes into Time, Latitude, Longitude, and Distance. At which point the data is then added into seperate items of a table.
Now the problem is the application seems to take forever to do this even with relatively small files, and I'm pretty sure that it is because the table is getting updated continuously throughout the loop. ( I wrote a similar program in delphi and it accomplishes the task in a fraction of the time )
Now if I lock the screen before the loop and unlock it after it goes much quicker, the problem is that I also have a progress bar that shows the user how far the application has processed, and of course the lock screen command screws that up entirely.
So basically I need a way of locking only the table field and not the entire screen. (And if there is a command in the Dictionary or Manual and I just missed it then I apologize in advance. I'm very new to Revolution Studio)
Here's basically what my code looks like:
* Open the file and store the contents in dbFile *
repeat while the length of dbFile > 0
// * Copy out 16 bytes from dbFile *
// * Take the bytes and do a load of stuff *
// * Put the results into seperate items of table field * <- This is the part that I think is slowing down my application.
// * Increment progress bar thumbposition *
end repeat
Any suggestions? Thanks in advance.
Updating fields are slowing my application
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Dear Wezz,
Why do you update the table field while you're still processing the data? Update a variable instead of the table field and put the data of the variable into the table field when the script finishes running.
The progress bar slows down your script too, but if you set the startValue of the progress bar to 0 and the endValue to 100 and update the progress bar only of the new thumbPos is different from the old thumbPos, then your script will run much faster.
Kind regards,
Mark
Why do you update the table field while you're still processing the data? Update a variable instead of the table field and put the data of the variable into the table field when the script finishes running.
The progress bar slows down your script too, but if you set the startValue of the progress bar to 0 and the endValue to 100 and update the progress bar only of the new thumbPos is different from the old thumbPos, then your script will run much faster.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Using a variable and updating the field in 1 shot is good advice. If that works, then it's very possible that what's slow is the constant refreshing of the field for displaying it. You may want to consider locking the screen.
And that should have the same effect as using a variable.
Jeff M.
Code: Select all
lock screen
-- update the field text here
unlock screen
Jeff M.