which is faster for searching?

FlexibleLearning.com admin at FlexibleLearning.com
Sat Aug 30 03:45:02 EDT 2014


Peter Haworth <pete at lcsql.com> wrote

> There's another situation where I use repeat with even though it's a
little
> slower than repeat for and I also alter the contents of the data I'm
> repeating through without any problems.
>
> repeat with x=the number of lines in tVar down to to 1
>    if <data condition on  line x of tVar> then
>       delete line x of tVar
>    end if
> end repeat

This is an insightful observation. Nice one, Pete!

My stock method (and presumably the method you allude to above) is...

repeat for each line L in tVar
    add 1 to x
    if <data condition on  L> then put "" into line x of tVar
end repeat
filter tVar without empty

Both methods operate on a single data set and avoid putting the output into
a second variable which, for large datasets, involve an unnecessary memory
overhead..

Hugh Senior
FLCo






More information about the use-livecode mailing list