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

Maciej Fijalkowski fijall at gmail.com
Thu Jun 19 20:54:26 CEST 2008


On Thu, Jun 19, 2008 at 1:03 AM, Raymond Hettinger <python at rcn.com> wrote:

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 BUILDSLICE? 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


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/fijall%40gmail.com

I think I should mention the code it comes from - it's pypy's translation toolchain and no, it's not trying to provide any data on "standard" python usage. For example CALL_LIKELY_BUILTIN comes from isinstance calls, which is not something completely natural to be called that often.

It of course depends on coding style, this is our coding style (ie pypy team).



More information about the Python-Dev mailing list