[Python-Dev] Bytecode analysis (original) (raw)

Guido van Rossum guido@python.org
Tue, 25 Feb 2003 20:25:11 -0500


As you say, LOADFAST 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 LOADFAST: index = (*p++) + (*p++)<<8 goto LOADFASTMAIN; break; case LOADFAST0: case LOADFAST1: case LOADFAST15: index = op - LOADFAST0 LOADFASTMAIN: ... break;

}

Good idea. Can you benchmark this?

--Guido van Rossum (home page: http://www.python.org/~guido/)