<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&quot;Preallocate objects, so we won&#39;t count gc time.&quot;<br>
n := 1000000.<br>
objects := Array new: n streamContents: [ :stream |<br>
        n timesRepeat: [ stream nextPut: Object new ] ].<div class="im"><br>
<br>
set := IdentitySet new: n.<br></div>
Smalltalk garbageCollect.<br>
[1 to: n do: [ :i | set add: (objects at: i) ] ] timeToRun. &quot;4949&quot;<br>
<br>
set := LargeIdentitySet new.<br>
Smalltalk garbageCollect.<br>
[1 to: n do: [ :i | set add: (objects at: i) ] ] timeToRun. &quot;331&quot;<br>
<br>
set := (PluggableSet new: n)<br>
        hashBlock: [ :object | object identityHash * 4096 + object class identityHash * 64 ]; &quot;Change this to #basicIdentityHash in Pharo&quot;<br>
        equalBlock: [ :a :b | a == b ];<br>
        yourself.<br>
Smalltalk garbageCollect.<br>
[1 to: n do: [ :i | set add: (objects at: i) ] ] timeToRun. &quot;5511&quot;<br>
<br>
<br>
I also have a LargeIdentityDictionary, which is relatively fast, but not as fast as LargeIdentitySet, because (for some unknown reason) we don&#39;t have a primitive that could support it. If we had a primitive like primitive 132 which would return the index of the element if found or 0 if not, then we could have a really fast LargeIdentityDictionary.<br>

<br></blockquote><div><br>Eliot do you think we could provide such a primitive?<br><br>Thanks<br><br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
Levente<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
Henry<br>
<br>
<br>
</blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>