Wait 0 doesn't

Dar Scott dsc at swcp.com
Tue Apr 29 15:02:00 CDT 2003


Duh.

On Tuesday, April 29, 2003, at 11:44 AM, Dar Scott wrote:

> With these results (note the first is usually long):
>
> 1.99, 0.25, 0.29, 0.26, 0.26, 0.26, 0.26, 0.22, 0.26, 0.26, 1.35, 
> 0.24, 0.26, 0.30, 0.26, 0.22, 0.26, 0.25, 0.26, 1.23, 0.28, 0.26, 
> 0.26, 0.22, 0.26, 0.25, 0.26, 0.22, 1.30, 0.28, 0.26, 0.22, 0.26, 
> 0.27, 0.26, 0.21, 0.26, 1.37, 0.27, 0.21, 0.22, 0.28, 0.25, 0.22, 
> 0.27, 0.25, 1.35, 0.37, 0.26, 0.26, 0.25, 0.26, 0.22, 0.26, 0.26, 
> 1.25, 0.28, 0.26, 0.22, 0.26, 0.25, 0.27, 0.26, 1.37, 0.28, 0.26, 
> 0.27, 0.26, 0.26, 0.21, 0.26, 1.35, 0.28, 0.26, 0.25, 0.26, 0.21, 
> 0.26, 0.25, 1.36, 0.27, 0.13, 0.26, 0.25, 0.26, 0.25, 0.25, 1.36, 
> 0.28, 0.26, 0.22, 0.26, 0.24, 0.26, 0.26, 1.39, 0.28, 0.26, 0.26, 
> 0.26, 0.21, 0.26, 1.35, 0.28, 0.26, 0.25, 0.26, 0.26, 0.25, 1.38, 
> 0.28, 0.27, 0.26, 0.22, 0.28, 0.25, 1.33, 0.36, 0.26, 0.25, 0.26, 
> 0.26, 0.26, 1.37, 0.27, 0.26, 0.26, 0.21, 0.23, 0.28, 1.35, 0.23, 
> 0.21, 0.32, 0.24, 1.38, 0.29, 0.43, 0.24, 0.22, 0.22, 0.27, 1.24, 
> 0.27, 0.26, 0.26, 0.26, 0.27, 0.22, 1.36, 0.27, 0.26, 0.26, 0.26, 
> 0.26, 0.26, 1.37, 0.28, 0.26, 0.26, 0.26, 0.26, 0.28, 1.35, 0.27, 
> 0.26, 0.26, 0.26, 0.26, 0.26, 1.48, 0.25, 0.27, 0.26, 0.13, 0.25, 
> 0.22, 1.41, 0.28, 0.27, 0.26, 0.26, 0.26, 0.25, 1.39, 0.28, 0.26, 
> 0.26, 0.25, 0.26, 0.26, 1.35, 0.28, 0.27, 0.26, 0.26, 0.26, 0.26, 
> 1.39, 0.24,
...
>  And, perhaps, delayed I/O related to your screen drawing may be going 
> on.
...
> Now.  Given all that.  I'm getting longer times than I did last night.

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




More information about the use-livecode mailing list