lineoffset slower than "repeat for each line j" ?
Jim Ault
JimAultWins at yahoo.com
Thu May 29 06:22:40 EDT 2008
I would be curious to know how the filter command works with your particular
data set. One of the speed difference factors I find is the exact
configuration of the data.
The filter command works fastest if the 'target' string in the first part of
a the line, and repeat for each seems to be much more consistent.
filter myVar with (tab & "*" & tab & "*" & "39900")
if myVar is not empty
--I know this does not solve your particular problem, but I am curious how
your data set performs.
By the way, the verbosity of Transcript and the many lines of code are
deceptive, since the compiled code is amazingly compact and efficient.
Jim Ault
Las Vegas
On 5/29/08 2:29 AM, "jbv" <jbv.silences at club-internet.fr> wrote:
> Hi list,
>
> Please excuse the remark, but I'd like to share something I just noticed
>
> and that surprised me a bit...
>
> I have a file loaded into a variable, which is about 8 Mb and consists
> in
> about 40000 lines of 3 items each (itemdel is tab).
>
> I need to know which line contains a certain value as 3rd item.
>
> Fist I used the following :
> get lineoffset(tab & "39900",myVar)
>
> which happens to take 200 ms when the found line is near the end.
>
>
> Then I tried this :
> put 0 into x
> repeat for each line j in myVar
> add 1 to x
> if last item of j = "39900" then
> put x into tResult
> exit repeat
> end if
> end repeat
>
> Surprisingly, this takes only 106 ms !!!
> If anyone asked me beforehand, I would have sweared that a built-in Rev
> function would run faster than a bunch of transcript lines of code...
>
> I'm using Rev cgi 2.5 on a Linux server.
>
> JB
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list