Things I Learned Recently

Alex Tweedly alex at tweedly.net
Thu Dec 11 07:22:05 EST 2008


jbv wrote:
> don't know if anyone is interested, but in the same vein, I've been living
> for years with the idea that variables organized as items were faster to
> process than variables organized as words, but lately I discovered that
> wordoffset is actually faster than itemoffset .
> Examples (tested on my old PC under XP with Rev 2.5) :
>
> put "toto tata titi tete" into myVar
> put the milliseconds into tt
> repeat 100000 times
>     if wordoffset("tete",ref) > 0 then
> end if
> end repeat
> put the milliseconds - tt
> --    returns a value between 103 and 110
>
> put "toto,tata,titi,tete" into myVar
> put the milliseconds into tt
> repeat 100000 times
>     if itemoffset("tete",ref) > 0 then
> end if
> end repeat
> put the milliseconds - tt
> --    returns a value between 130 and 136
>
> wordoffset seems to be 15 to 20% faster, which is a lot IMHO...
>
>   
I agree 15-20% seems significant - but I get almost exactly the opposite 
results from that test :-)

I get itemoffset returning times around 52-54, while wordoffset gives 
around 43-44 - suggesting itemoffset is around 20% slower.

(on Windows Vista, Rev 3.0)

-- Alex.



More information about the use-livecode mailing list