1 more speed question

Dave Cragg dcragg at lacscentre.co.uk
Thu May 19 05:20:35 EDT 2005


On 19 May 2005, at 08:00, Mark Wieder wrote:

> Jacque-
>
> Wednesday, May 18, 2005, 8:03:53 PM, you wrote:
>
> JLG> This came up on the MetaCard list back in the dark ages. Scott  
> Raney
> JLG> said the engine figures out the variable so we don't have to,  
> and the
> JLG> two should be identical in speed.
>
> Maybe I'm still in the dark ages... I wrote up a new speed test here
> and the loop that uses a variable seems to be running some 25 times
> faster than the one that evaluates the limit each time.
>
> on mouseUp
>   local elapsedTime, x, y, z
>
>   put the milliseconds into elapsedTime
>   put the number of controls on card id 200593 of stack "revIcons"  
> into y
>   repeat 1000 times
>     repeat with x=1 to y
>       add 1 to z
>     end repeat
>   end repeat
>   put the milliseconds - elapsedTime into field "fldResult1"
> end mouseUp
>
> on mouseUp
>   local elapsedTime, x, z
>
>   put the milliseconds into elapsedTime
>   repeat 1000 times
>     repeat with x=1 to the number of controls on card id 200593 of  
> stack "revIcons"
>       add 1 to z
>     end repeat
>   end repeat
>   put the milliseconds - elapsedTime into field "fldResult2"
> end mouseUp
>
> Maybe the optimization only happens in a standalone? Or am I the only
> one who's seeing these results?

Using your scripts, I'm seeing the same results. But if I change to  
"the number of controls of this card" (where the card has 250  
fields), it's very different  -- similar times for both methods.  
Strange.

Dave




More information about the use-livecode mailing list