On 10/11/00 5:56 pm, James C. Wall <[EMAIL PROTECTED]> wrote:

> I use a lot of repeat loops and have not really considered efficiency
> until thi posting arrived.  The approach I use is as follows
> 
> put the number of lines of tData into x
> put 1 into i
> repeat x
> ##do something to line i of tData>end repeat
> add 1 to i
> end repeat
> 
> Would this overcome the problem stated by Dave?

No.  You are still accesing the data line by line (i.e. from the start each
time), rather than splitting it up by using "repeat for each" - which goes
through the data just once start to finish.  Even though your script is
altering lines in a variable, it is still going to be much faster (if there
is a lot of data) to *rebuild* that variable in another (e.g. tFinalData,
below):

put empty into tFinalData
repeat for each line l in tData
  --do something to l, e.g. put "modified" after it
  put l && "modified" & cr after tFinalData
end repeat
delete last char of tFinalData --always remove trailing cr

Regards,

Kevin

Kevin Miller <[EMAIL PROTECTED]> <http://www.runrev.com/>
Runtime Revolution Limited (formerly Cross Worlds Computing).
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.


Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to