<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 28, 2012 at 7:52 PM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br><br><div class="gmail_quote"><span class="">On Mon, Feb 27, 2012 at 3:16 PM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>On Sat, 25 Feb 2012, Mariano Martinez Peck wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
            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>
<br>
<br>
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<br>
(IdentityDictionary, PluggableIdentityDictionary, subclassing, etc). I&#39;m about to propose this primitive with other improvements on the vm-dev<br>
list.<br>
</blockquote>
<br></div>
My proposals are still on the way. :)<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<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>
</blockquote>
<br></div>
AFAIK the new primitive is not implemented yet. Adding the primitive to the interpreter VM is very easy, but it seems to be a lot more complicated (to me) to add it to Cog, because the receiver can be a MethodContext which needs special handling.<br>

I&#39;ll rewrite both LargeIdentitySet and LargeIdentityDictionary when the primitive is ready.<span><font color="#888888"><br></font></span></blockquote></span><div><br>Thanks Levente. So we should wait Eliot.<br>
I will ping again in a couple of weeks/months  ;)<br><br></div></div></blockquote><div><br></div><div><br></div><div>I am reviving a very old thread.</div><div>Levente, as you know, we are using a variation of your LargeIdentitySet and LargeIdentityDictionary for Fuel. </div><div>Considering Spur&#39;s new #identityHash, had you have the chance to try/think if these large collection classes is still worth?</div><div>What it seems clear is that with Spur we could simply replace:</div><div><br></div><div><div>ProtoObject &gt;&gt; largeIdentityHash</div><div><br></div><div><span class="" style="white-space:pre">        </span>&lt;primitive: 75&gt;</div></div><div><br></div><div>With:</div><div><br></div><div><div>ProtoObject &gt;&gt; largeIdentityHash</div><div><br></div><div><span class="" style="white-space:pre">        </span>^ self basicIdentityHash </div></div><div><br></div><div>Right?</div><div><br></div><div>But I still wonder about the collection classes itself. </div><div><br></div><div>Thoughts? </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_quote"><div> </div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span><font color="#888888">
<br>
<br>
Levente</font></span><div><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Thanks!<br>
<br>
<br>
<br>
<br>
<br>
<br>
 <br>
<br>
      Levente<br>
<br>
<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>
      On Fri, 16 Dec 2011, Henrik Sperre Johansen wrote:<br>
<br>
       On 16.12.2011 03:26, Levente Uzonyi wrote:<br>
<br>
<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>
      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>
(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<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>
<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>
      Cheers,<br>
      Henry<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a><br>
<br>
<br>
<br>
<br>
<br>
--<br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a><br>
<br>
<br>
</blockquote>
</div></div></blockquote></div></div></div><span class=""><font color="#888888"><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br></div>
</div></div>