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

Hannes Hirzel hannes.hirzel at gmail.com
Fri May 14 17:47:05 UTC 2010


On 5/14/10, Levente Uzonyi <leves at elte.hu> wrote:
> On Fri, 14 May 2010, christophe.jalady at free.fr wrote:
>
>> Just print this two scripts:
>>
>> |s|
>> s := WideString with: (Character value: 16r55E4).
>> [100000 timesRepeat: [s hash]] timeToRun.
>>
>> |s|
>> s := ByteString with: (Character value: 16rE4) with: (Character value:
>> 16rE4)
>> with: (Character value: 16rE4) with: (Character value: 16rE4).
>> [100000 timesRepeat: [s hash]] timeToRun.
>>
>> I've seen that "ByteString>>stringHash:initialHash" use a primitive. Could
>> we
>> have such optimisation for WideString ?



> Sure. There are (at least) four ways to do it:
> 1) Update the implementation of the primitive to support wordarrays. Then
> build a vm with it and finally change the image side code. This would be
> the best IMHO. Is there a reason why the primitive is not implemented this
> way?

If this is not a work you feel comfortable with then post this on the
VM developer list and/or create a Mantis entry.

> 2) Use NativeBoost to write a primitive for this method. This is much
> easier than building a vm/plugin, though you have to write the code in X86
> assembly. This would be a cool demo for NativeBoost's primitive writing
> capabilities. (Much better than the Fibonacci-number calculator. :))

Yes, this would be a very good demonstration.


> 3) Use Exupery, I think it can optimize methods like this.
> 4) Use the Cog VM. ;) (I wonder how fast this method is with Cog.)
What kind of VM are we using in 4.1? It supports closures, but
seeminly is not the Cog VM(yet)?


Hannes



More information about the Squeak-dev mailing list