NumberedPrimitives must die! (Was: Re: [Vm-dev] VM Maker: VMMaker.oscog-topa.1900.mcz)

tim Rowledge tim at
Mon Jul 11 20:48:22 UTC 2016

> On 11-07-2016, at 11:43 AM, Clément Bera <bera.clement at> wrote:
> So far I understood that numbered primitives were there for performance. 

Originally they were there as the only method of looking the up, of course. Then after we added named prims for modules the prim table was indeed the route to ‘fast prims’ because the lookup time was incurred too often. Then in ’04 I fixed that by expanding the method cache tables to include the function address etc and after that it made no real difference.

> Let's talk for example of (SmallInteger>>#+). What is the overhead if we have it as a named primitive and not a numbered primitive ? Is there even overhead ?

No overhead at all for a lot of key prims since they’re compiled by the Cog to machine code - see CogObjectRepresentation>>#genPrimitiveAdd etc. Well, there would be a very small cost at Cog time I guess, at least the first time a prim is encountered. 

None of this is really crucial, it’s just a thing I think would clean up the concept of primitives and calling them.

tim Rowledge; tim at;
Strange OpCodes: XER: Exclusive ERror

More information about the Vm-dev mailing list