[squeak-dev] WideString hash is way slower than ByteString hash.
christophe.jalady at free.fr
christophe.jalady at free.fr
Fri May 14 22:53:23 UTC 2010
Should the hash function be the same between ByteString and WideString ?
I mean: if a WideString contains the same characters than a ByteString, I guess that they should have both the same hashcode no ?
Christophe
----- Mail Original -----
De: "Igor Stasenko" <siguctua at gmail.com>
À: "The general-purpose Squeak developers list" <squeak-dev at lists.squeakfoundation.org>
Envoyé: Samedi 15 Mai 2010 00h26:18 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [squeak-dev] WideString hash is way slower than ByteString hash.
added implementation into examples package:
http://www.squeaksource.com/NativeBoost/NativeBoost-Examples-Igor.Stasenko.1.mcz
On 15 May 2010 01:14, Igor Stasenko <siguctua at gmail.com> wrote:
> I implemented WideString hash in NB.
>
> |s|
> s := WideString with: (Character value: 16r55E4).
> [100000000 timesRepeat: [s hash]] timeToRun. 155718
>
>
> |s|
> s := WideString with: (Character value: 16r55E4).
> [100000000 timesRepeat: [s nbHash]] timeToRun. 81231
>
> Which makes me think, that we're benching the outer loop, rather then
> hash function itself :)
>
> So, here is more appropriate , i think:
>
> |s t1 t2 |
> s := (WideString with: (Character value: 16r55E4)) , 'abcdefghijklmno'.
> 10 timesRepeat: [ s := s , s ].
> self assert: (s hash = s nbHash).
> t1 := [1000 timesRepeat: [s hash]] timeToRun.
> t2 := [1000 timesRepeat: [s nbHash]] timeToRun.
>
> { t1. t2 }
> #(11479 134)
>
> ~ 85x faster :)
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|