Timing Accuracy of "Move" command

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Timing Accuracy of "Move" command

Post by dunbarx » Wed Nov 09, 2016 8:27 pm

If I move an object to the points of a certain graphic in, say, 3 seconds, the actual time to travel the course is always about 0.25 seconds more. It is not a scalable thing. If I move in 30 seconds, it is about 0.25 seconds more.

Guess what it is in 300 seconds.

This was carefully measured with a digital stopwatch. If I use the ticks to measure the timing, I get "accurate" readings. It seems the ticks are in cahoots with LC seconds, but not real seconds. In other words:

Code: Select all

on mouseUp
   put the ticks into tt
   wait 5 seconds
   answer the ticks - tt
end mouseUp
.

Gives 300 in the dialog. But the measured time is, just guess, about 0.25 seconds longer. It is obviously a conspiracy.

There have been many threads where users did indeed require pretty good accuracy, and many methods to get pretty close. All well and good.

If the ticks are just a little bit longer than they ought to be, the difference would scale. Why is there a constant extra quarter second?

Craig

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Timing Accuracy of "Move" command

Post by [-hh] » Wed Nov 09, 2016 8:57 pm

Hi Craig.

"Move to the points in 3 seconds" means that 3 seconds are the time *for the move*. This doesn't include the preparation: computing the length of the path and the move speed, determining the time/speed for the animation from point to point.
This preparation adds to the move time and probably may constantly get (doesn't really need all) up to 250 ms.

Hermann
shiftLock happens

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Timing Accuracy of "Move" command

Post by dunbarx » Wed Nov 09, 2016 9:37 pm

Hermann.

OK. I actually thought that task might take some time, though MUCH less than anything I could actually detect in the real world. There is no "moveStart" message for me to initialize the timing (there is a "moveStopped")

But that does not explain the ticks-only handler. No moves there...

Craig

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Timing Accuracy of "Move" command

Post by [-hh] » Wed Nov 09, 2016 10:13 pm

Preparing the answer dialog and the screen update may need some time ( usually up to 50 ms). Also, if your reaction time for the stopwatch is below 0.1 seconds then you are at top measured across all ages. Now 2*0.1+ 0.05 = 0.25 seconds ...
shiftLock happens

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Timing Accuracy of "Move" command

Post by dunbarx » Wed Nov 09, 2016 11:09 pm

Hermann.

This occurred to me as well, that the suspicious constant might be with me.

It would explain a lot.

So I retried my test. Do know that I used a square as my set of points, and timed the stop/start not by looking at the screen but by timing the four legs of the journey with my impeccable internal clock. It now seems that the extra time has been reduced to 0.12 seconds.

This could be a clue... :oops:

Craig

I am leaving the red face, but there is a real delay. Likely the stuff Hermann mentioned, though I would have thought that effort took much less time than an eighth of a second.

So.

8)

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Timing Accuracy of "Move" command

Post by [-hh] » Thu Nov 10, 2016 12:11 am

WOW, 7 ticks. Faster than HC allows ;-)

Congratulations. The best reaction time I ever had was 10 ticks, when I was a young man with curly hair.

[7 ticks sounds good, I'll name my next project after that.]
shiftLock happens

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Timing Accuracy of "Move" command

Post by dunbarx » Fri Nov 11, 2016 10:17 pm

Hermann.

It shouldn't be a surprise. After all, 7 is 42 divided by the first perfect number.

Craig

Post Reply