<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 12:33 PM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</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 23.06.2015, at 18:23, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Bert,<br>
&gt;<br>
&gt; On Jun 23, 2015, at 3:38 AM, Bert Freudenberg &lt;<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; On 23.06.2015, at 02:58, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;&gt;&gt; On an interpreter VM, the results are as Tim and I initially expected:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; | i | i := SmallInteger maxVal + 1.<br>
&gt;&gt;&gt; (1 to: 6) collect: [:j| {[1 to: 10000000 do: [:k| i numberedLessThan: i]]<br>
&gt;&gt;&gt; timeToRun. [1 to: 10000000 do: [:k| i namedLessThan: i]] timeToRun}]<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ==&gt; #(#(791 789) #(793 794) #(793 790) #(791 791) #(790 794) #(795 789))<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; With a Cog VM, the numbered primitives are significantly faster:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; | i | i := SmallInteger maxVal + 1.<br>
&gt;&gt;&gt; (1 to: 6) collect: [:j| {[1 to: 10000000 do: [:k| i numberedLessThan: i]]<br>
&gt;&gt;&gt; timeToRun. [1 to: 10000000 do: [:k| i namedLessThan: i]] timeToRun}]<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ==&gt; #(#(542 670) #(542 668) #(544 678) #(546 680) #(540 666) #(540 680))<br>
&gt;&gt;<br>
&gt;&gt; Looks like SqueakJS may need some caching for named prim lookup:<br>
&gt;&gt;<br>
&gt;&gt; ((54 535 ) (42 541 ) (42 536 ) (49 542 ) (44 527 ) (44 530 ) )<br>
&gt;<br>
&gt;<br>
&gt; I think this is an inlined apples vs oranges comparison :).  To be that fast surely the JS VM has optimized away the numbered primitive send entirely, leaving only the named primitive send, so this isn&#39;t the difference between the two at all.<br>
<br>
Haha, no. I removed two zeroes from the iteration count ;)<br></blockquote><div><br></div><div>ROTFL :)</div></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>