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

Eliot Miranda eliot.miranda at gmail.com
Fri May 14 22:38:17 UTC 2010


Hi Igor,

    is the NB implementation mapping the character codes in the wide strings
into Character objects and taking the character hashes?  If so, very cool.
 The NB code is very fast.  If on the other hand you're just
short-circuiting the character code lookup then you're cheating :)

On Fri, May 14, 2010 at 3:31 PM, Igor Stasenko <siguctua at gmail.com> wrote:

> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100514/0b167478/attachment.htm


More information about the Squeak-dev mailing list