[squeak-dev] WideString hash is way slower than ByteString hash.

Igor Stasenko siguctua at gmail.com
Fri May 14 22:31:54 UTC 2010


Oh, yeah..
i forgot to hash the strings.. for comparison:

|ss s t1 t2 t3 |
s := (WideString with: (Character value: 16r55E4)) , 'abcdefghijklmno'.
ss := (String with: $z) , 'abcdefghijklmno'.

10 timesRepeat: [ s := s , s. ss := ss , ss ].
self assert: (s hash = s nbHash).
t1 := [1000 timesRepeat: [s hash]] timeToRun.
t2 := [1000 timesRepeat: [s nbHash]] timeToRun.
t3 := [1000 timesRepeat: [ss hash]] timeToRun.
{ t1. t2. t3 }
 #(11477 134 190)

so, WideString>>nbHash outperforms ByteString>>hash a little, for same
string sizes. ;)

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list