<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

All I can say is that I am impressed by the numbers it is really much<br>
faster.<br>
I still don&#39;t understand why I send this email with a subject say<br>
IdentitySet because what I really need is a fast/large IdentityDictionary<br>
:(  Anyway, there&#39;s a place where we can use this LargeIdentitySet in Fuel<br>
I think).<br>
<br>
So Levente, you say this is not possible to adapt this for dictionary?  can<br>
we contact Eliot to provide such a primitive?<br>
</blockquote>
<br></div>
As promised, I uploaded my LargeIdentityDictionary implementation to <a href="http://leves.web.elte.hu/squeak/LargeIdentityDictionary.st" target="_blank">http://leves.web.elte.hu/<u></u>squeak/<u></u>LargeIdentityDictionary.st</a> .<br>

The numbers will be a bit worse compared to LargeIdentitySet, because of the lack of the primitive, but it&#39;s still 2-3x faster than other solutions (IdentityDictionary, PluggableIdentityDictionary, subclassing, etc). I&#39;m about to propose this primitive with other improvements on the vm-dev list.<br>

<br></blockquote><div><br>Hi Eliot/Levente. What is the status of this? Do we have already the new primitive? If true, how can we adapt LargeIdentitySet to use such new primitive?<br><br>Thanks!<br><br><br><br><br><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"><div><div class="h5">
<br>
thanks<br>
<br>
On Fri, Dec 16, 2011 at 3:28 PM, Levente Uzonyi &lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt; wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
On Fri, 16 Dec 2011, Henrik Sperre Johansen wrote:<br>
<br>
 On 16.12.2011 03:26, Levente Uzonyi wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
How about my numbers? :)<br>
<br>
&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 ] ].<br>
<br>
set := IdentitySet new: n.<br>
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<br>
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<br>
as fast as LargeIdentitySet, because (for some unknown reason) we don&#39;t<br>
have a primitive that could support it. If we had a primitive like<br>
primitive 132 which would return the index of the element if found or 0 if<br>
not, then we could have a really fast LargeIdentityDictionary.<br>
<br>
<br>
Levente<br>
<br>
</blockquote>
Hehe yes, if writing a version fully exploiting the limited range, that&#39;s<br>
probably the approach I would go for as well.<br></div></div>
(IAssuming it&#39;s the version at <a href="http://leves.web.elte.hu/**" target="_blank">http://leves.web.elte.hu/**</a><br>
squeak/LargeIdentitySet.st&lt;<a href="http://leves.web.elte.hu/squeak/LargeIdentitySet.st" target="_blank">htt<u></u>p://leves.web.elte.hu/squeak/<u></u>LargeIdentitySet.st</a>&gt;<br>
)<br>
<br>
Mariano commented in the version at <a href="http://www.squeaksource.com/**" target="_blank">http://www.squeaksource.com/**</a><br>
FuelExperiments &lt;<a href="http://www.squeaksource.com/FuelExperiments" target="_blank">http://www.squeaksource.com/<u></u>FuelExperiments</a>&gt; that it&#39;s<div class="im"><br>
slow for them, which I guess is due to not adopting #identityHash calls to<br>
#basicIdentityHash calls for Pharo:<br>
((0 to: 4095) collect: [:each | each &lt;&lt; 22 \\ 4096 ]) asSet size -&gt; 1<br>
So it basically uses 1 bucket instead of 4096... Whoops. :)<br>
<br>
Uploaded a new version to the MC repository which is adapted for Pharo,<br>
on the same machine my numbers were taken from, it does the same test as I<br>
used above in 871 ms. (181 with preallocation).<br>
<br>
</div></blockquote><div class="im">
<br>
Cool. One more thing: in Squeak the method using primitive 132 directly<br>
was renamed to #instVarsInclude:, so now #pointsTo: works as expected. If<br>
this was also added to Pharo, then the #pointsTo: sends should be changed<br>
to #instVarsInclude:, otherwise Array can be reported as included even if<br>
it wasn&#39;t added.<br>
I&#39;ll upload my LargeIdentityDictionary implementation to the same place<br>
this evening, since it&#39;s still 2-3 factor faster than other solutionts and<br>
there seem to be demand for it.<br>
<br>
<br>
Levente<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cheers,<br>
Henry<br>
<br>
<br>
<br>
</blockquote>
<br>
</div></blockquote>
<br><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a><br>
<br>
</font></span></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>