[Python-Dev] Bytecode analysis
Guido van Rossum
guido@python.org
Tue, 25 Feb 2003 20:25:11 -0500
> As you say, LOAD_FAST is a very frequently occuring instruction, both
> statically and dynamically. Reducing it from a 3 byte instruction to a 1
> byte instruction in 97% of (static) cases should be an overall good.
>
> Most of the opcodes I proposed could be added without disturbing
> locality of reference.
>
> e.g.
>
> switch (op = *p++) {
> ...
> case LOAD_FAST:
> index = (*p++) + (*p++)<<8
> goto LOAD_FAST_MAIN;
> break;
> case LOAD_FAST_0:
> case LOAD_FAST_1:
> case LOAD_FAST_15:
> index = op - LOAD_FAST_0
> LOAD_FAST_MAIN:
> ...
> break;
>
>
> }
Good idea. Can you benchmark this?
--Guido van Rossum (home page: http://www.python.org/~guido/)