<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 2:08 PM, Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span> wrote:<br>
<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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div></div><div>However, if all the associationsDo: block does is invoke a primitive then the Squeak profiler will not produce useful info.  The default profiler doesn&#39;t profile primitives correctly.  As others in this thread have pointed out there;s a better profiler written by Andreas Raab, which does profile primitives properly.</div>
</div></div></div></blockquote><div><br></div><div style>That&#39;s the issue, alright.</div><div style><br></div><div style>Here&#39;s the code:</div><div style><br></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>adds keysAndValuesDo:</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>[:key :vector |</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>repository add: key vector: vector.</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>vector becomeForward: nil copyHash: false].</font></div><div style><font face="courier new, monospace"> </font></div><div style><font face="arial, helvetica, sans-serif">I had assumed that #add:vector: was the culprit, because it does serialization, which involves walking the object graph rooted in the vector and lots of double-dispatch. I found the FFI call and commented it out, and running under the interpreter I was able to see all the serialization in the profile. It was still a tiny proportion of the total time, but without Cog to speed it up, it was at least showing up on the profile! That made me realize how much time was being spent in primitives.</font></div>
<div style><font face="arial, helvetica, sans-serif"><br></font></div><div style><font face="arial, helvetica, sans-serif">The fix is easy—just batch up the the objects to become, then do them all at once with #elementsForwardIdentityTo:copyHash:. </font></div>
<div style><font face="arial, helvetica, sans-serif"><br></font></div><div style><font face="arial, helvetica, sans-serif">Thanks all, for the help, and apologies for being slow to respond. I&#39;ve been without internet for the last few days.</font></div>
<div style><font face="arial, helvetica, sans-serif"><br></font></div><div style><font face="arial, helvetica, sans-serif">Colin</font></div></div></div></div>