Hi Levente,<br><br><div class="gmail_quote">On Thu, Nov 26, 2009 at 12:01 PM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu">leves@elte.hu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On Thu, 26 Nov 2009, Eliot Miranda wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I wouldn&#39;t bother trying to fix the primitive.  Both in VisualWorks and at Teleplace the experience has been the same, getting rid of the primitives for next, nextPut: and atEnd sped things up.  The system is simply too complex nowadays for these primitives to pay for themselves because they only cover a small number of cases.  The primitives support Array and ByteString bow there are so many different kinds of arrays being streamed over that the cost of primitive failures outweigh the benefits of primitive successes.<br>

</blockquote>
<br></div>
We are using these primitives in our own stream implementation like this:<br>
<br>
next<br>
<br>
        &lt;primitive: 65&gt;<br>
        [ position &lt; readLimit ] whileFalse: [ self receiveData ].<br>
        ^buffer at: (position := position + 1)<br>
<br>
And it does make a difference (buffer is a 8kiB sized ByteArray). Would this be faster without the primitive?<br></blockquote><div><br></div><div>I can&#39;t guarantee it.  You&#39;d have to measure.  All I can say is that we found it better to get rid of the stream primitives in VisualWorks and in the Cog JIT.  Looking at the Squeak VM code I think the primitives will still win in the interpreter; after all they use the same machinery as at: and at:put:.  But in a JIT they&#39;ll likely loose.</div>
<div><br></div><div>Since the Cog JIT isn&#39;t available yet I&#39;m not really being helpful.  I should think before I blurt.  Apologies.</div><div><br></div><div>Eliot</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888">
<br>
Levente<br>
</font></blockquote></div><br>