[pypy-dev] Bytecode counting patch

Ben.Young at risk.sungard.com Ben.Young at risk.sungard.com
Mon Aug 7 17:00:26 CEST 2006


Carl Friedrich Bolz <cfbolz at gmx.de> wrote on 07/08/2006 15:56:55:

> Hi Ben!
> 
> Ben.Young at risk.sungard.com wrote:
> > Here's a patch that counts the number of times the different bytecodes
> are
> > used. I haven't tried doing translation yet as I can't use the work
> > machine cycles, but it can't be far off. I've put the counts on the
> object
> > space as this is accessable from most places.
> >
> > I've also implemented something that should resort the opcodes in the
> > switch statement of the bytecode dispatcher according to the 
statistics I
> > found. This may have a slight speed improvement.
> 
> Looks quite good. The only thing I don't really like is the fact that
> the logbytecodes config options is in the global option name space.
> Should probably be config.objspace.logbytecodes or even introduce an new
> interpreter name space and be config.interpreter.logbytecodes
> 

Thanks! I think it should have gone in objspace. It originally was, but 
then I moved the count onto ExecutionContext for a while, so I put it in 
global. Feel free to move it.

The other bit I'm not sure about it the reporting of the results. At the 
momement it's just a hack in py.py, but it should go in objspace.finish. 
However, I couldn't work out how to print from there.

Cheers,
Ben

> Cheers,
> 
> Carl Friedrich
> 
> 




More information about the Pypy-dev mailing list