SC, Rev,and RB speed test

Dar Scott dsc at swcp.com
Thu Apr 15 05:31:01 EDT 2004


On Thursday, April 15, 2004, at 02:38 AM, Brian Yennie wrote:

> Harumph. What are we missing?

The short data tests show the speeds are the same.  The long data tests 
show a difference:

Match in first 4 chars using 'contains':
2.5 meg  4510 microseconds
1.0 meg   995 microseconds
0.5 meg   381 microseconds
0.2 meg   112 microseconds
0.1 meg    32 microseconds

10,000    2.3 microseconds
  1,000    1.04 microseconds


2.5 Meg
'contains' find in first 4 chars:    4510 microseconds
'contains' fails:                   48877 microseconds
offset() find in first 4 chars:         0.83  microseconds
offset() fails:                     43032 microseconds

I thought maybe 'contains' was optimized for failures, but that does 
not seem to be the case.

I would have thought that 'is in' and 'contains' would compile the same 
thing.  I guess not.

My data consisted of "1234567890" repeated.  Maybe for more typical 
text, contains does something optimal.  I'll quickly write a novel.

Dar Scott



More information about the use-livecode mailing list