Ann: Simple Spirograph-like toy program.

Alex Tweedly alex at tweedly.net
Tue Jun 21 06:05:59 EDT 2005


John Ridge wrote:

>sec
>I don't understand the point of "wait 0..." When I comment out the line, the
>program runs 300 revolutions in 2300 millisecs on my system (this is an
>average of 10 trials, using the default settings as in the stack you
>uploaded). With the line back in at "wait 0", it takes 1962 ms on average.
>This seems a little odd.
>
>But the weird thing is that the second, faster version with "wait 0..."
>actually runs far more slowly - the millisecs are lying to me! Using a
>stopwatch (I know :-)) I reckon it takes about 10 times as long as it
>reports - around 19 seconds in real time, while the commented-out version is
>running in just about the time that the millisecs report.
>
>I have looked hard at the code, and at the documentation of "wait". Now my
>brain hurts. What am I missing?
>  
>
Don't know what's going on for you. I can tell you the observations of 
timing on my system ....

Code                               Points        updates     
msec         wristwatch :-)

as downloaded
wait 1 ms ....       4622    106     5648     6 seconds seems right

modified to
wait 0 ms            4622      2      109     less than a second

commented out
-- ....              4622      2       99     less than a second

Is it possible you put in O (the letter) instead of 0 (the digit) ? 
   (shouldn't be - gives me an error - but maybe different settings ???)


The point of "wait 0 msec with messages" is to provide an opportunity 
for other messages to be handled. In this case, the "Stop" button can be 
pressed and will stop the drawing by unsetting "gKeepDrawing"; without 
the wait line, processing this message wouldn't happen until after the 
loop had finished.

-- 
Alex Tweedly       http://www.tweedly.net




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.8/22 - Release Date: 17/06/2005



More information about the use-livecode mailing list