Wait 0 doesn't

Jim Hurley jhurley at infostations.com
Tue Apr 29 20:00:01 EDT 2003


>
>Message: 7
>Date: Tue, 29 Apr 2003 13:00:10 -0600
>Subject: Re: Wait 0 doesn't
>From: Dar Scott
>
>New handler that doesn't write to field in the loop:
>
>on mouseUP
>    put the long seconds into endT  -- avoid first time overhead for long
>seconds
>    put empty into reportT
>    put the long seconds into startT
>    put the long seconds into endT
>    put (endT-startT) into deadT
>    put "Offset used: " & deadT*1000 & " ms" & linefeed after reportT
>    set numberFormat to "0.000"
>    repeat 200
>      put the long seconds into startT
>      wait 0 seconds
>      --myWait 0
>      put the long seconds into endT
>      put (endT - startT) - deadT into actualT
>      put  actualT*1000 & comma & space after reportT
>    end repeat
>    put reportT into field "report"
>end mouseUP
>
>Results:
>
>Offset used: 0.003934 ms
>0.845, 0.103, 0.092, 0.090, 0.089, 0.088, 0.087, 0.087, 0.087, 0.092,
>0.088, 0.087, 0.087, 0.087, 0.086, 0.086, 0.105, 0.098, 0.091, 0.088,
>0.088, 0.087, 0.087, 0.087, 0.087, 0.086, 0.087, 0.087, 0.087, 0.089,
>0.088, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087,
>0.087, 0.087, 0.086, 0.087, 0.087, 0.087, 0.086, 0.088, 0.087, 0.087,
>0.087, 0.087, 0.087, 0.087, 0.087, 0.210, 0.102, 0.090, 0.088, 0.087,
>0.087, 0.087, 0.087, 0.087, 0.086, 0.087, 0.087, 0.087, 0.086, 0.087,
>0.086, 0.087, 0.087, 0.086, 0.087, 0.087, 0.086, 0.087, 0.094, 0.089,
>0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.086, 0.087, 0.086, 0.087,
>0.087, 0.086, 0.097, 0.089, 0.087, 0.087, 0.087, 0.087, 0.087, 0.086,
>0.087, 0.086, 0.088, 0.088, 0.087, 0.087, 0.087, 0.086, 0.087, 0.087,
>0.086, 0.086, 0.099, 0.088, 0.088, 0.087, 0.087, 0.087, 0.087, 0.087,
>0.087, 0.087, 0.087, 0.086, 0.087, 0.087, 0.087, 0.086, 0.087, 0.087,
>0.087, 0.087, 0.087, 0.087, 0.086, 0.087, 0.086, 0.087, 0.086, 0.087,
>0.087, 0.086, 0.087, 0.087, 0.086, 0.087, 0.086, 0.087, 0.087, 0.086,
>0.087, 0.087, 0.086, 0.087, 0.086, 0.087, 0.087, 0.087, 0.086, 0.087,
>0.087, 0.086, 0.087, 0.087, 0.086, 0.087, 0.086, 0.087, 0.087, 0.087,
>0.087, 0.086, 0.087, 0.087, 0.091, 0.088, 0.087, 0.087, 0.086, 0.087,
>0.087, 0.086, 0.087, 0.087, 0.086, 0.087, 0.087, 0.086, 0.087, 0.087,
>0.086, 0.087, 0.087, 0.086, 0.087, 0.086, 0.087, 0.087, 0.087, 0.087,
>
>It seems that the writing to the field creates some delayed work for
>either the OS or the engine and that tends to be done at the wait. 
>That may also explain why the first wait is often long; the button
>image has changed or something else at the start has created some
>delayed work.
>
>The drawing of your program, Jim, probably does the same thing.  Some
>delayed work is generated and it is done at the wait.  Perhaps it is
>deferred until the end of the drawing when there is no wait.
>
>I think we are getting a better feel for what is going on.
>
>It is hard for my mind to keep up with OS enhancements and processor
>speeds, so my judgment here is poor, but even 87 microseconds seems a
>little long.  Even so, it is just fine for Revolution on these kinds of
>OS's.
>
>Dar Scott

Dar (and David),

Thanks for all the thought you have put into this. I'm sure you are 
right about the ghost of other events working in the background.

The results seem to be very machine  dependant. Using your script I 
get on by G3 350 Mhz (no other applications running):

Offset used: 0.012994 ms
3.427, 4.958, 4.116, 0.739, 0.546, 4.314, 2.780, 2.072, 2.061, 2.796, 
1.790, 3.068, 4.991, 4.942, 1.126, 1.787, 1.817, 3.070, 1.783, 4.991, 
4.277, 0.576, 1.016, 3.608, 5.319, 4.113, 0.727, 0.158, 4.307, 0.909, 
3.703, 2.212, 0.821, 1.812, 5.182, 0.217, 0.180, 0.172, 0.171, 0.172, 
0.171, 0.170, 0.171, 0.171, 0.171, 0.171, 0.171, 0.172, 0.171, 
-0.013, 0.367, 0.179, 0.171, 0.170, 0.170, 0.171, 0.173, 0.170, 
0.171, 0.169, 0.171, 0.169, 0.171, 0.170, 0.171, 0.423, 0.176, 0.185, 
0.171, 0.169, 0.171, 0.171, 0.171, 0.171, 0.171, 0.441, 0.073, 0.177, 
0.170, 0.171, 0.171, 0.172, -0.013, 0.186, 0.173, 0.171, 0.171, 
0.306, 0.186, 0.171, 0.172, 0.171, 0.171, 0.179, 0.171, 0.171, 0.171, 
0.454, -0.013, 0.186, 0.172, 0.170, 0.173, 0.173, 0.171, 0.171, 
0.173, 0.171, 0.171, 0.171, 0.170, 0.171, 0.171, 0.173, -0.013, 
0.306, 0.175, 0.171, 0.174, 0.172, 0.171, 0.171, 0.171, 0.170, 0.171, 
0.171, 0.170, 0.171, 0.422, 0.087, 0.400, 0.213, 0.180, 0.171, 0.171, 
0.238, 0.176, 0.170, 0.171, 0.171, 0.171, 0.175, 0.170, 0.171, 0.171, 
0.171, 0.475, -0.013, 0.188, 0.171, 0.171, 0.175, 0.170, 0.170, 
0.171, 0.170, 0.171, 0.172, 0.171, 0.169, 0.171, 0.174, 0.171, 0.332, 
0.407, 0.180, 0.171, 0.170, 0.171, 0.171, 0.171, 0.171, 0.171, 0.172, 
0.170, 0.171, 0.170, 0.171, 0.224, 0.336, 0.284, -0.013, 0.181, 
0.171, 0.171, 0.170, 0.171, 0.171, 0.171, 0.171, 0.171, 0.171, 0.172, 
0.170, 0.171, 0.417, 0.196, 0.184, 0.173, 0.171

With a minimum of  -0.013 and a maximum of  5.319 -- Lots of 
consistency, but still substantial variation. Even more variation on 
my G3 PowerBook. But almost none on the PC.

In any event, I can now take comfortable in the knowledge that I am 
not alone. And I have a work-around  for my application. So I think, 
in the future,  I will wait 0 seconds on the issue.




More information about the use-livecode mailing list