[Vm-dev] Performance of primitiveFailFor: and use of primFailCode

David T. Lewis lewis at mail.msen.com
Tue May 24 12:00:28 UTC 2011


On Tue, May 24, 2011 at 10:46:02AM +0200, Igor Stasenko wrote:
>  
> >
> > No mistake, the performance problem was real.
> >
> > Good news - I found the cause. Better news - this may be good for a
> > performance boost on StackVM and possibly Cog also.
> >
> > The performance hit was due almost entirely to InterpreterPrimitives>>failed,
> > and perhaps a little bit to #successful and #success: also.
> >
> > This issue with #failed is due to "^primFailCode ~= 0" which, for purposes
> > of C translation, can be recoded as "^primFailCode" with an override in
> > the simulator as "^primFailCode ~= 0". This produces a significant speed
> > improvement, at least as fast as for the original interpreter implementation
> > using successFlag.
> >
> > I expect that the same change applied to StackInterpreter may give a similar
> > 10% improvement (though I have not tried it). I don't know what to expect
> > with Cog, but it may give a boost there as well.
> >
> > Changes attached, also included in VMMaker-dtl.237 on SqueakSource.
> >
> > Dave
> >
> >
> >
> 
> added to http://code.google.com/p/cog/issues/detail?id=45

Thanks Igor.

> 
> it is strange that such small detail  could make a lot of difference in speed.

Yes, I was very surprised to see it also. It will be interesting to see
if it has a similar effect for StackInterpreter. I probably will not have
time to check this for a while, so if you try it please let us know
what you find.

Dave
 


More information about the Vm-dev mailing list