[Python-Dev] Opcode frequency (original) (raw)

Raymond Hettinger python at rcn.com
Thu Jun 19 01:03:19 CEST 2008


Maciej Fijalkowski did an opcode analysis for PyPy, it also shows the relative frequency of opcodes following a specifc one:

http://codespeak.net/svn/user/fijal/opcodes.txt Might it make sense to add more PREDICT()ions based on this, e.g. for BUILDSLICE -> BINARYSUBSCR?

This particular one might be okay. What code generates it? Are there other possible successors to BUILD_SLICE? What code generates those?

There were lots of other opcode pairings that were previously studied and rejected. You're going over well traveled ground.

Also, opcode analysis is a somewhat hazardous undertaking. Dynamic analysis takes into account which codes tend to occur more often inside loops but it is very sensitive to who wrote the app and their coding style. These results always have to be taken with a grain of salt.

Raymond



More information about the Python-Dev mailing list