This is difficult to explain, but I have an app that is running too slowly. Being fairly new to Livecode I suspect I've chosen the wrong way to code it, and would appreciate some advice on the best way to re-code.
At the moment (by which I mean I intend to add further functions) the app displays a digital clock, showing hh:mm:ss, and two stop watches, which display to tenths of seconds. The stop watches are started/paused by tapping the displays, and reset via a swipe. The clock is, well, a clock, so it just runs.
Until yesterday, I had been testing on the iPad simulator. With both stop watches running along with clock, the display was kind-of jerky... with not all of the tenths of seconds showing. I figured, it's just a simulator, so yesterday I transferred the app to my iPad1.
On the iPad the app is a disaster. With all three displays running, the iPad seems to be seriously overloaded. Tapping a display to pause a stop watch can take five seconds before the app responds. And the displays only get updated every one to two seconds. It's useless.
A while ago, before knowing anything about Livecode, I developed this with a little html and several kilometers of javascript. Running in a browser on the iPad, it's fine. Fully functional, no delays.
So, clearly I have done something stupid in Livecode!
I have three routines, one for the clock and one each for the stopwatches. RunCLK, RunSW1 and RunSW2.
At the end of the openCard script, I simply call these three routines to start them.
At the end of RunCLK I have...
Code: Select all
send "RunCLK" to me in 250 milliseconds
Code: Select all
send "RunSW1" to me in 50 milliseconds
Code: Select all
send "RunSW2" to me in 50 milliseconds
So; what did I do wrong ???
I'm guessing it's the "send blahblahblah to me in ..." that's causing the problems. Should I have coded this in one routine that calls itself every 50ms? Would that help?
Or is there some totally different way to achieve this?
Any thoughts/advice would be greatly appreciated coz right now I have good looking app that is totally useless.
Many thanks...
--paul