Another empirical speed test

Bruce Robertson bfr at nwlink.com
Sat Mar 12 05:43:11 EST 2005


> # Test 1 code
> repeat with K1 = 1 to the number of lines in DerData
>   put item 3 of line K1 of DerData into line K1 of DerData
> end repeat
> # Time: 18 seconds
> 
> # Test 2 code
> put "" into Rezult
> repeat (the number of lines in DerData)
>   put (item 3 of line 1 of DerData) & return before Rezult
>   delete line 1 of DerData
> end repeat
> # Time: 6.7 seconds
> 
> # Test 3 code
> put "" into Rezult
> repeat for each line LL in DerData
>   put return & (item 3 of LL) after Rezult
> end repeat
> # !!! !!! !!! -- Time: < .03 seconds -- !!! !!! !!!

Have you considered doing tests 1 and 2 by first capturing number of lines
instead of recalculating it each time through?

Something like this:

Put number of lines in DerData into numlines
repeat with K1 = 1 to numlines
   put item 3 of line K1 of DerData into line K1 of DerData
end repeat



More information about the use-livecode mailing list