Things I Learned Recently

jbv jbv.silences at club-internet.fr
Thu Dec 11 07:24:18 EST 2008



Mark Wieder a *crit :

> Some Things I Thought I Knew But On Checking Find Aren't True
>
> 1. Back in the day I could have sworn that "contains" was deprecated
> as being much slower than "is in", in that it made an extra copy of
> the target before checking. This is no longer true, if it ever was.
> The following two statements run at exactly the same speed:

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...

Best,
JB




More information about the use-livecode mailing list