Contains vs is in

hh hh at hyperhh.de
Mon Jan 2 18:02:27 EST 2017


But there is interestingly the fact that both are faster than

put offset("foo","this is a string with foo in it") > 0 into r3

(seen by 'enlarging' your test).
Quite clear because "is in" and "contains" do the ">0" test in the engine, while the above needs a further comparison of two numbers:

put offset("foo","this is a string with foo in it") into r3
without checking the function return is fastest.

I wasn't aware of that, good to know, "is in"/"contains" is 10% faster than "offset() > 0".

[And once again: LC 6 is here 2.5 times faster than LC 9 using your test.]



More information about the use-livecode mailing list