<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"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></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 <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br>
><br>
> Hi Bert,<br>
><br>
> On Jun 23, 2015, at 3:38 AM, Bert Freudenberg <<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>> wrote:<br>
><br>
>> On 23.06.2015, at 02:58, David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br>
>>> On an interpreter VM, the results are as Tim and I initially expected:<br>
>>><br>
>>> | i | i := SmallInteger maxVal + 1.<br>
>>> (1 to: 6) collect: [:j| {[1 to: 10000000 do: [:k| i numberedLessThan: i]]<br>
>>> timeToRun. [1 to: 10000000 do: [:k| i namedLessThan: i]] timeToRun}]<br>
>>><br>
>>> ==> #(#(791 789) #(793 794) #(793 790) #(791 791) #(790 794) #(795 789))<br>
>>><br>
>>> With a Cog VM, the numbered primitives are significantly faster:<br>
>>><br>
>>> | i | i := SmallInteger maxVal + 1.<br>
>>> (1 to: 6) collect: [:j| {[1 to: 10000000 do: [:k| i numberedLessThan: i]]<br>
>>> timeToRun. [1 to: 10000000 do: [:k| i namedLessThan: i]] timeToRun}]<br>
>>><br>
>>> ==> #(#(542 670) #(542 668) #(544 678) #(546 680) #(540 666) #(540 680))<br>
>><br>
>> Looks like SqueakJS may need some caching for named prim lookup:<br>
>><br>
>> ((54 535 ) (42 541 ) (42 536 ) (49 542 ) (44 527 ) (44 530 ) )<br>
><br>
><br>
> 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'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>