[Python-Dev] Bytecode analysis (original) (raw)
Skip Montanaro skip@pobox.com
Tue, 25 Feb 2003 16:59:03 -0600
- Previous message: [Python-Dev] Bytecode analysis
- Next message: [Python-Dev] Bytecode analysis
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Damien> Ive done a static analysis of the bytecodes from compiling the
Damien> python standard library:
...
Nice input, but I think you should deal with dynamic opcode frequencies. See the #define's in the ceval.c source for how to enable that and the recent thread in c.l.py. In short, it doesn't really matter how many LOAD_CONST instructions appear in the bytecode stream, only how many of them are executed. While LOAD_CONST is a relatively frequently executed opcode, if I recall correctly, LOAD_FAST is much more frequently executed, and LOAD_CONST is already pretty fast, so adding special opcodes probably won't buy you much and runs the risk of disturbing what locality of reference exists.
The LOAD_IF_FALSE issue was discussed recently (here I think). The problem is that chained operations like
if a < b < c:
...
require the value be retained. You could get rid of the separate POP_TOP instruction but it would require some work in the compiler.
as-always-patches-are-welcome-ly, y'rs,
Skip
- Previous message: [Python-Dev] Bytecode analysis
- Next message: [Python-Dev] Bytecode analysis
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]