Things I Learned Recently

Mark Wieder mwieder at ahsoftware.net
Wed Dec 10 21:27:28 EST 2008


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:

if x contains y then
if y is in x then

2. I also thought that the predefined constants zero and one, etc.
existed so that the compiler didn't have to evaluate a numeric value
at runtime and so were much faster to use in scripts. This also turns
out not to be the case:

put 0 into x
    is noticeably faster than
put zero into x

which probably begs the question, *why* would one use the predefined
constants if they're actually slower than their numeric equivalents?

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the Use-livecode mailing list