SC, Rev,and RB speed test

Dar Scott dsc at swcp.com
Thu Apr 15 04:02:26 EDT 2004


On Wednesday, April 14, 2004, at 11:47 PM, Brian Yennie wrote:

> The following gave me about a 25% speedup by using offset() instead of 
> "contains".

On my system (Dual 1.25 GHz G4, 167 MHz bus) these execute the same.  I 
wonder if they influence other code to make the other code slower.

get "a" contains "x"  -- .61 microseconds
get "a1234567890" contains "x" -- .76 microseconds
get "a12345678901234567890" contains "x"  -- .89 microseconds
get "a123456789012345678901234567890" contains "x"  -- 1.05 microseconds
get "a1234567890123456789012345678901234567890" contains "x" -- 1.18 
microseconds
get "a12345678901234567890123456789012345678901234567890" contains "x" 
-- 1.30 microseconds

14 ns / char  delta for small searches


get offset("x","a") <> 0 -- .96 microseconds
get offset("x","a1234567890") <> 0  -- 1.05 microseconds
get offset("x","a12345678901234567890") <> 0 -- 1.24 microseconds
get offset("x","a123456789012345678901234567890") <> 0 -- 1.31 
microseconds
get offset("x","a1234567890123456789012345678901234567890") <> 0 -- 
1.43 microseconds
get offset("x","a12345678901234567890123456789012345678901234567890") 
<> 0 1.58 microseconds

12 ns / char  delta for small searches


get thousandChars contains "x"       -- 12.13 microseconds
get offset("x",thousandChars) <> 0   -- 12.21 microseconds

get offset("x",chars100000) <> 0     --  1138.46 microseconds
get chars100000 contains "x"         --  1170.01 microseconds

get thousandChars contains "x2345678901234567890"      -- 12.01 
microseconds
get offset("x2345678901234567890",thousandChars) <> 0  -- 12.08 
microseconds

Dar Scott




More information about the use-livecode mailing list