Mark,

This seems highly data-dependent and contrary to logic to me. In my tests:

put line 1 to -2 of tData into tData1
delete line -1 of tData
delete last line of tData

All perform about twice as fast as using "repeat for each". The first was about 
10% faster than the next two, which makes sense as it would only be one seek 
and one copy. The in-place operations would require a seek, a copy, and 
resizing the original variable. Of course if you end up copying back to the 
original variable somewhere, it should be very close to the same.

"repeat for each" is asking the engine to find every line ending in the text 
which would necessarily take much longer and get worse with scale, no?

> And on reading the code yet another time, there's enough fuzzy stuff
> in there to make me discount most of it without rewriting.
> Nonetheless, the conclusions are fairly solid, and the fastest way to
> delete the last line of a variable turns out to be the surprising
> 
>   put empty into tData1
>   put 1 into x
>   put the number of lines in tData into tHowMany
>   repeat for each line tLine in tData
>       put tLine & cr after tData1
>       add 1 to x
>       if x is tHowMany then
>           exit repeat
>       end if
>   end repeat
> 
> -- 
> -Mark Wieder
> [email protected]
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to