<br><br><div class="gmail_quote">On Mon, May 23, 2011 at 8:42 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 <br>On Mon, May 23, 2011 at 07:30:09PM -0400, David T. Lewis wrote:<br>
&gt; On Mon, May 23, 2011 at 02:33:52PM -0700, Eliot Miranda wrote:<br>
&gt; &gt;<br>
&gt; &gt; On Mon, May 23, 2011 at 2:08 PM, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;  Testing success status, original:<br>
&gt; &gt; &gt;        if (foo-&gt;successFlag) { ... }<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;  Testing success status, new:<br>
&gt; &gt; &gt;        if (foo-&gt;primFailCode == 0) { ... }<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;  Setting failure status, original:<br>
&gt; &gt; &gt;         foo-&gt;successFlag = 0;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;  Setting failure status, new:<br>
&gt; &gt; &gt;        if (foo-&gt;primFailCode == 0) {<br>
&gt; &gt; &gt;                foo-&gt;primFailCode = 1;<br>
&gt; &gt; &gt;        }<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; So in each case the global struct is being used, both for successFlag<br>
&gt; &gt; &gt; and primFailCode. Sorry for the confusion. In any case, I&#39;m still left<br>
&gt; &gt; &gt; scratching my head over the size of the performance difference.<br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; One thought, where are successFlag and primFailCode in the struct?  Perhaps<br>
&gt; &gt; the size of the offset needed to access them makes a difference?<br>
&gt;<br>
&gt; In both cases they are the first element of the struct, so that<br>
&gt; cannot be it.<br>
&gt;<br>
&gt; I think I had better circle back and redo my tests. Maybe I made<br>
&gt; a mistake somewhere.<br>
&gt;<br>
<br>
No mistake, the performance problem was real.<br>
<br>
Good news - I found the cause. Better news - this may be good for a<br>
performance boost on StackVM and possibly Cog also.<br></blockquote><div><br></div><div>thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
The performance hit was due almost entirely to InterpreterPrimitives&gt;&gt;failed,<br>
and perhaps a little bit to #successful and #success: also.<br>
<br>
This issue with #failed is due to &quot;^primFailCode ~= 0&quot; which, for purposes<br>
of C translation, can be recoded as &quot;^primFailCode&quot; with an override in<br>
the simulator as &quot;^primFailCode ~= 0&quot;. This produces a significant speed<br>
improvement, at least as fast as for the original interpreter implementation<br>
using successFlag.<br></blockquote><div><br></div><div>Note that with the Cog code generator and for the purposes of the simulator this can read</div><div><br></div><div>failed</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;api&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>^self cCode: [primFailCode] inSmalltalk: [primFailCode ~= 0]</div></div><div><br></div><div>The Cog inliner maps self cCode: aCBlock inSmalltalk: anStBlock to aCBlock at TMethod creation time, hence avoiding the inability to inline cCode:inSmallalk:.  See MessageNode&gt;&gt;asTranslatorNode: in the Cog VMMaker.  I&#39;ll integrate as such in Cog.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
I expect that the same change applied to StackInterpreter may give a similar<br>
10% improvement (though I have not tried it). I don&#39;t know what to expect<br>
with Cog, but it may give a boost there as well.<br>
<br>
Changes attached, also included in VMMaker-dtl.237 on SqueakSource.<br>
<br>
Dave<br>
<br>
<br></blockquote></div><br>