[Vm-dev] how slower is called a named primitive over a numbered
primitive?
Bert Freudenberg
bert at freudenbergs.de
Tue Jun 23 10:38:14 UTC 2015
On 23.06.2015, at 02:58, David T. Lewis <lewis at mail.msen.com> wrote:
> On an interpreter VM, the results are as Tim and I initially expected:
>
> | i | i := SmallInteger maxVal + 1.
> (1 to: 6) collect: [:j| {[1 to: 10000000 do: [:k| i numberedLessThan: i]]
> timeToRun. [1 to: 10000000 do: [:k| i namedLessThan: i]] timeToRun}]
>
> ==> #(#(791 789) #(793 794) #(793 790) #(791 791) #(790 794) #(795 789))
>
> With a Cog VM, the numbered primitives are significantly faster:
>
> | i | i := SmallInteger maxVal + 1.
> (1 to: 6) collect: [:j| {[1 to: 10000000 do: [:k| i numberedLessThan: i]]
> timeToRun. [1 to: 10000000 do: [:k| i namedLessThan: i]] timeToRun}]
>
> ==> #(#(542 670) #(542 668) #(544 678) #(546 680) #(540 666) #(540 680))
Looks like SqueakJS may need some caching for named prim lookup:
((54 535 ) (42 541 ) (42 536 ) (49 542 ) (44 527 ) (44 530 ) )
- Bert -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4115 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150623/e0cb7364/smime.bin
More information about the Vm-dev
mailing list