which is faster for searching?

Mike Bonner bonnmike at gmail.com
Sat Aug 30 13:05:38 EDT 2014


Hugh, just did a test.. Rather than putting empty into the line and then
filtering without empty, seems to be quite a bit faster to "then delete
line x of tVar"

Still has the slowdown caused by accessing the lines of the var using "line
x of.." but saves the time for the filter. With the data I generated for
the test, 100k lines, the delete method took 5.3 secs, the filter method
took 14.5.

The system i'm on at the moment, only has LC 6.6.2 though, and I seem to
remember someone mentioning large speed differences depending on LC
version, so if i'm running into that, someone let me know.  Or if there is
a reason to NOT directly delete the line, let me know that too.


On Sat, Aug 30, 2014 at 1:45 AM, FlexibleLearning.com <
admin at flexiblelearning.com> wrote:

> 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
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list