[Vm-dev] how slower is called a named primitive over a numbered primitive?

tim Rowledge tim at rowledge.org
Mon Jun 22 21:29:15 UTC 2015


On 22-06-2015, at 11:05 AM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> | 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}]
> 
> #(#(191 283) #(211 375) #(281 405) #(300 411) #(281 421) #(296 409)) #(#(186 267) #(201 273) #(210 364) #(294 410) #(313 400) #(292 405))

And on a Pi2/Cog we get typical results of 2250 2650 - so 400mS per 10e7 calls, implying about 40nS per. Which is about 35 instructions on a Pi2’s cpy. So really, not going to actually make any interesting contribution to the total time for an FFI call and the library routine it calls.

It will be interesting to work out exactly why there is any difference at all. Just don’t hold your breath.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: RSC: Rewind System Clock




More information about the Vm-dev mailing list