[Python-Dev] Opcode frequency
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:
>> Might it make sense to add more PREDICT()ions based
>> on this, e.g. for BUILD_SLICE -> BINARY_SUBSCR?
> 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.
> Python-Dev mailing list
> Python-Dev at python.org
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