<br><br><div class="gmail_quote">On Thu, Nov 26, 2009 at 8:43 AM, 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>
I opened a Mantis bug report for this issue:<br>
<br>
  <a href="http://bugs.squeak.org/view.php?id=7421" target="_blank">http://bugs.squeak.org/view.php?id=7421</a><br>
<br>
Dave<br></blockquote><div><br></div><div>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.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
On Thu, Nov 26, 2009 at 03:10:52PM +0100, Henrik Johansen wrote:<br>
&gt;<br>
&gt; Interpreter &gt;&gt; primitiveNextPut:<br>
&gt;  limit := self fetchInteger: StreamReadLimitIndex ofObject: stream.<br>
&gt;       atIx := (array bitAnd: AtCacheMask) + AtPutBase.<br>
&gt;       (index &lt; limit and: [(atCache at: atIx+AtCacheOop) = array])<br>
&gt;<br>
&gt; so basically, it needs ReadLimit to be &gt; 0. (Which is only true for (Read)WriteStreams if created with on:from:to:).<br>
&gt;<br>
&gt; Changing the first line to<br>
&gt;  limit := self fetchInteger: StreamWriteLimitIndex ofObject: stream.<br>
&gt;<br>
&gt; and the primitive now works.<br>
&gt; ws := WriteStream on: (String new: 500000).<br>
&gt; [1 to: 500000 do: [:ix | ws nextPut: $a]] timeToRun<br>
&gt;<br>
&gt; before: 130<br>
&gt;  after: 33<br>
&gt;<br>
&gt; Inserted a counter after the prim call, for the loop above it was always &gt;= 500000, with fix it&#39;s &gt;=1.<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Henry<br>
&gt;<br>
</div></div></blockquote></div><br>