[Python-Dev] Python 3 optimizations, continued, continued again...

stefan brunthaler s.brunthaler at uci.edu
Wed Feb 1 16:55:20 CET 2012


> How many times did you regenerate this code until you got it right?

Well, honestly, I changed the code generator to "pack" the new
optimized instruction derivatives densly into the available opcodes,
so that I can make optimal use of what's there. Thus I only generated
the code twice for this patch.

> And how do you know that you really got it so right that it was the last time ever
> that you needed your generator for it?

I am positive that I am going to need my code generator in the future,
as I have several ideas to increase performance even more. As I have
mentioned before, my quickening based inline caching technique is very
simple, and if it would crash, chances are that any of the
inline-cache miss guards don't capture all scenarios, i.e., are
non-exhaustive. The regression-tests run, so do the official
benchmarks plus the computer language benchmarks game. In addition,
this has been my line of research since 2009, so I have extensive
experience with it, too.

> What if the C structure of any of those "several types" ever changes?

Since I optimize interpreter instructions, any change that affects
their implementation requires changing of the optimized instructions,
too. Having the code generator ready for such things would certainly
be a good idea (probably also for generating the default interpreter
dispatch loop), since you could also add your own "profile" for your
application/domain to re-use the remaining 30+ instruction opcodes.
The direct answer is that I would need to re-generate the driver file,
which is basically a gdb-dump plus an Emacs macro (please note that I
did not need to do that since working with ~ 3.0b1) I will add a list
of the types I use for specializing to patch section on the
"additional resources" page of my homepage (including a fixed patch of
what Georg brought to my attention.)

--stefan


More information about the Python-Dev mailing list