SC, Rev,and RB speed test

Brian Yennie briany at qldlearning.com
Thu Apr 15 04:19:41 EDT 2004


Dar,

It seems to have to do with the size of the string searched, but it 
takes a bit more to trigger it.
Try this one in your message box:

put empty into tLongText
repeat 1000
    put "This is a string to find things in" after tLongText
end repeat
put "string to find" into tFindText
put the milliseconds into sTime
repeat 10000
   get offset(tFindText, tLongText)
end repeat
put the milliseconds into eTime
answer (eTime - sTime)
put the milliseconds into sTime
repeat 10000
   get (tLongText contains tFindText)
end repeat
put the milliseconds into eTime
answer (eTime - sTime)

Try changing the first loop from 10 to 1000 to 10000 and watch how much 
of a difference it makes. It almost looks like the "contains" operator 
keeps on searching even after the first match... wouldn't that be 
awfully inefficient! In fact, if it's really doing that for no good 
reason, I might say it's a bug- but maybe there's something I'm missing.

- Brian



More information about the use-livecode mailing list