SC, Rev,and RB speed test

Brian Yennie briany at qldlearning.com
Thu Apr 15 04:25:55 EDT 2004


Ah hah! Try these two scripts. The timed portion of the first SHOULDN'T 
run any faster than the second, but it does. The "contains" operator 
should be bailing as soon as it matches "zoom" in the first 4 
characters, but it's clearly scanning the entire text. Tsk tsk...

#####

put "zoom" into tLongText
put "zoom" into tFindText
put the milliseconds into sTime
repeat 100
   get (tLongText contains tFindText)
end repeat
put the milliseconds into eTime
answer (eTime - sTime)

####

Now this:

put "zoom" into tLongText
repeat 100000
    put "This is a string to find things in" after tLongText
end repeat
put "zoom" into tFindText
put the milliseconds into sTime
repeat 100
   get (tLongText contains tFindText)
end repeat
put the milliseconds into eTime
answer (eTime - sTime)

####



More information about the use-livecode mailing list