stringCompare performance

Tim Olson tim at jumpnet.com
Wed May 6 13:15:40 UTC 1998


>I've looked at the performance data at
>
>  http://www.concentric.net/~Dgirle/Smalltalk/Performance.html
>
>and it is very strange to see that Squeak has performance that is two
>orders of magnitude worse than all the other systems for stringCompare.
>Any idea why?

The stringCompareTest there is comparing the equality of two long, 
literal strings (which are equal).  In most Smalltalk implementations, 
the compiler recognizes that the literal strings are the same, and uses a 
single literal for both of them.  This means that not only are the 
strings #=, they are also #==.

I suspect that the other "fast" Smalltalk implementations have an 
early-out test for #== strings in the #= method, whereas Squeak's 
Collection>>= method does not.

One could easily change Squeak's #= method to include this, but I think 
it would be good to change the benchmark slightly so that actual 
character comparisons are being performed (by, say, making some of the 
string comparisons unequal in the last characters).



     -- tim





More information about the Squeak-dev mailing list