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

Igor Stasenko siguctua at gmail.com
Sat May 15 00:26:28 UTC 2010


2010/5/15 Levente Uzonyi <leves at elte.hu>:
> Hi again,
>
> On Sat, 15 May 2010, Igor Stasenko wrote:
>
>> added implementation into examples package:
>>
>> http://www.squeaksource.com/NativeBoost/NativeBoost-Examples-Igor.Stasenko.1.mcz
>
> just tried to run the following code:
>
> 'foo' asWideString nbHash
>
> but I get an assertion failure at this line:
> imul: ESI with: 16r260D;  " 16r260D * low "
> The code generator is unhappy about ESI. In
> AJInstructionDescription >> #emitimul:operand1:operand2:operand3:
> There's an assertion:
> self assert: op1 isRegTypeGPW.
> If I just press proceed, it will be unhappy with the other two registers
> passed to #imul:with:, but the code compiles and works, so probably the
> assertion is wrong.
>
ah yes, i just commented this assert out.
I don't sure, but it seems either placed in a wrong place or wrong.

>
> Levente
>
>>
>> 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.
>>
>
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list