The cardinal rule of running benchmarks is to compare apples to apples.  You&#39;ve compared apples to oranges, i.e. an optimized reimplementation of WideString&gt;&gt;hash that eliminates the mapping of codes to characters, against the vanilla Squeak implementation.  You need to at least compare the NB implementation against<div>
<br></div><div>WideString methods for comparison</div><div><div><div>fastHash</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| stringSize hash low |</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>stringSize := self size.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>hash := ByteString identityHash bitAnd: 16rFFFFFFF.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1 to: stringSize do: [:pos |</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>hash := hash + (self wordAt: pos).</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>&quot;Begin hashMultiply&quot;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>low := hash bitAnd: 16383.</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>hash := (16r260D * low + ((16r260D * (hash bitShift: -14) + (16r0065 * low) bitAnd: 16383) * 16384)) bitAnd: 16r0FFFFFFF.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>].</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>^ hash</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| s n |</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>s := (WideString with: (Character value: 16r55E4)) , &#39;abcdefghijklmno&#39;.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>n := 100000.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>{ [1 to: n do: [:i| s fastHash. s fastHash. s fastHash. s fastHash. s fastHash. s fastHash. s fastHash. s fastHash. s fastHash. s fastHash]] timeToRun.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>  [1 to: n do: [:i| s hash. s hash. s hash. s hash. s hash. s hash. s hash. s hash. s hash. s hash]] timeToRun. }</div><div><br></div><div>     #(829 1254)</div>
<div><br></div><div>ASo your measurements tell us nothing about a general comparison of NB against the Squeak VM or Cog.  They only demonstrate (unsurprisingly) that a loop summing integers in an array goes PDQ.  On the other hand my numbers showed Cog 10x faster than the Squeak interpreter when executing exactly the same bytecode.</div>
<div><br></div><div>best</div><div>Eliot</div></div><div><br></div></div><div><br><div class="gmail_quote">On Fri, May 14, 2010 at 4:13 PM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">And besides, if someone would bother implementing a primitive<br>
for hasing the WideString, i doubt that he will go and create<br>
an instances of Character for each indice, and then read its value and<br>
only then use<br>
it for hashing.<br>
So, i don&#39;t think this is cheating. Its just an optimization :)<br>
Of course, Cog , even if it optimize things cleverly, still has to<br>
follow a code, and should create a real instances of Character,<br>
simply because it is written so, and it should honor the language semantics.<br>
<div><div></div><div class="h5"><br>
<br>
On 15 May 2010 01:53, Igor Stasenko &lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt; wrote:<br>
&gt; On 15 May 2010 01:38, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
&gt;&gt; Hi Igor,<br>
&gt;&gt;     is the NB implementation mapping the character codes in the wide strings<br>
&gt;&gt; into Character objects and taking the character hashes?  If so, very cool.<br>
&gt;&gt;  The NB code is very fast.  If on the other hand you&#39;re just<br>
&gt;&gt; short-circuiting the character code lookup then you&#39;re cheating :)<br>
&gt;&gt;<br>
&gt; What mapping you have in mind?<br>
&gt;<br>
&gt; WideString&gt;&gt;at: index<br>
&gt;        &quot;Answer the Character stored in the field of the receiver indexed by<br>
&gt; the argument.&quot;<br>
&gt;        ^ Character value: (self wordAt: index).<br>
&gt;<br>
&gt; Character class&gt;&gt;value: anInteger<br>
&gt;        &quot;Answer the Character whose value is anInteger.&quot;<br>
&gt;<br>
&gt;        anInteger &gt; 255 ifTrue: [^self basicNew setValue: anInteger].<br>
&gt;        ^ CharacterTable at: anInteger + 1.<br>
&gt;<br>
&gt; (Character classPool at: #CharacterTable) withIndexDo: [:ch :i | self<br>
&gt; assert: (ch asInteger = (i-1))]<br>
&gt;<br>
&gt; So, it is 1:1 correspondence between word, stored in wide string (self<br>
&gt; wordAt: index),<br>
&gt; and Character value, used for hashing. So, no mapping required.<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Best regards,<br>
&gt; Igor Stasenko AKA sig.<br>
&gt;<br>
<br>
<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</div></div></blockquote></div><br></div>