Posted to tcl by dkf at Mon Sep 20 22:27:15 GMT 2010view pretty

C:\Documents and Settings\Donal>tclsh85
% info patch
8.5.2
% package require ActiveTcl
8.5.2.0.284846
% eval {set str1 [string repeat "*" 10000]
set str2 ${str1}b
append str1 a ;string length $str1}
10001
% time {string equal   $str1 $str2} 10000
16.0505 microseconds per iteration
% time {string compare $str1 $str2} 10000
10.9383 microseconds per iteration
% time {string equal   $str1 $str2} 100000
15.98994 microseconds per iteration
% time {string compare $str1 $str2} 100000
11.02129 microseconds per iteration
% eval {set str1 [string repeat "*" 100000]
set str2 ${str1}b
append str1 a ;string length $str1}
100001
% time {string equal   $str1 $str2} 10000
181.5137 microseconds per iteration
% time {string compare $str1 $str2} 10000
115.1879 microseconds per iteration