[Python-Dev] Possible optimization for LOAD_FAST ?

Victor Stinner victor.stinner at haypocalc.com
Sun Jan 2 14:17:27 CET 2011


Le mercredi 29 décembre 2010 à 14:20 +0100, "Martin v. Löwis" a écrit :
> Am 28.12.2010 18:08, schrieb Lukas Lueg:
> > Also, the
> > load_fast in lne 22 to reference x could be taken out of the loop as x
> > will always point to the same object....
> 
> That's not true; a debugger may change the value of x.

That's why Python has the following option:

-O     : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x

I regulary recompile programs with gcc -O0 -g to debug them. It is very
difficult to debug (with gdb) a program compiled with gcc -O2: many
variables are stored in registers, and gdb doesn't support that
correctly.

Victor



More information about the Python-Dev mailing list