Is there a faster way...

Dar Scott dsc at swcp.com
Fri May 3 12:47:01 EDT 2002


On Friday, May 3, 2002, at 11:21 AM, Ken Ray wrote:

> Two quick "speed-up" suggestions:
>
> (1) Use "repeat for each" instead for "repeat with" - it is a lot 
> faster, if
> you make Rev increment a counter:
>
> put 0 into tCounter
> repeat for each line tLine in field "Directory"
>   add 1 to tCounter
>   if (item 1 of tLine) & " " & (item 2 of tLine) <> vName then
> (etc.)

Does this access the field each time through the loop?  Or is a 
hidden temporary variable used for the value of field "Directory"?

>
> (2) Don't put the progress into a field (or if you do, don't do it 
> for each
> loop - do it every 10 or 100 loops) - this slows things down quite 
> a bit. To
> do things every 100 loops, you can use the 'mod' function:
>
(3) Build up your menu in a variable and set it after the loop.

Dar Scott




More information about the use-livecode mailing list