lineoffset slower than "repeat for each line j" ?

Mark Schonewille m.schonewille at economy-x-talk.com
Thu May 29 05:35:11 EDT 2008


Hi JB,

Repeat for each has proven to be surprisingly fast, before. So, I  
wouldn't be surprised if it beats the offset function, although I do  
wonder why the offset function would be that slow.

Best,

Mark

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
  for more info.

On 29 mei 2008, at 11:29, jbv 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





More information about the use-livecode mailing list