Revolution speed sucks?
Alex Rice
alrice at ARCplanning.com
Fri Aug 8 01:10:02 EDT 2003
On Thursday, August 7, 2003, at 08:16 PM, Björnke von Gierke wrote:
>
>> repeat for each line theLine in theWinners --note: NOT "each line
>> theLine in fld winners"
>
> This is wrong. Actually when you do a "repeat for each" loop, then you
> generate automatically a variable at the beginning of the loop and
> then use that. Hence it is impossible to change a container directly
> with that loop (putting something into "theLine" does not change the
> appropiate line of "theWinners"). When you generate another variable
> before the loop then that will only use more memory. (I tested that
> once and speed is equal for both cases)
>
Björnke, I don't understand what's wrong about it. Don't understand
what you mean about using more memory. "repeat for each line" is
supposed to be faster than any other loop form in transcript. Maybe you
can write a counter example to show what I'm doing badly?
If one needed to modify theWinners while inside the loop, and maybe it
wouldn't be necessary, but supposing one needed to, wouldn't one just
maintain the line count in parallel, like this? I think I've seen this
idiom used before:
put fld "winners" into theWinners
put 0 into tLineNo
repeat for each line theLine in theWinners
add 1 to tLineNo
if "target" is among the items of theLine then
put "found target here" into line tLineNo of tWinner
end if
end repeat
I would be glad to be corrected- I'm still pretty new to this
optimizing transcript stuff.
Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com
More information about the use-livecode
mailing list