1 more speed question

Mark Wieder mwieder at ahsoftware.net
Thu May 19 11:31:10 EDT 2005


Thursday, May 19, 2005, 5:28:28 AM, you wrote:

DC> Please ignore all my previous comments on this topic. I just now paid
DC> attention to the test script. The "limit expression" is in an inner
DC> repeat loop which is within a loop that repeats 1000 times. So  
DC> naturally, the expression is evaluated 1000 times. In the other  
DC> method it is calculated before both loops.

DC> Time for more coffee.

I think I'll celebrate with some more coffee, too. Placing the
variable assignment inside the timing loop evens things out. Thanks
for finding this - I've been staring at the code trying to figure out
what the difference was.

Next test: since there are 450 controls on that card, I changed the
assignment line to "put 450 into y". This again speeded things up even
inside the timing loop to a speed factor of about 25, so it's not the
assignment of the loop variable that I was seeing slowing things down,
but the calculation of the number of controls on the card. I hadn't
realized quite how slow that action is, but at any rate it's good to
verify Scott Raney's statement about the way loops work.

-Mark Wieder
 mwieder at ahsoftware.net

More information about the Use-livecode mailing list