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

stefan brunthaler stefan at brunthaler.net
Tue Aug 30 22:41:01 CEST 2011


> Ok, there there's something else you haven't told us. Are you saying
> that the original (old) bytecode is still used (and hence written to
> and read from .pyc files)?
>
Short answer: yes.
Long answer: I added an invocation counter to the code object and keep
interpreting in the usual Python interpreter until this counter
reaches a configurable threshold. When it reaches this threshold, I
create the new instruction format and interpret with this optimized
representation. All the macros look exactly the same in the source
code, they are just redefined to use the different instruction format.
I am at no point serializing this representation or the runtime
information gathered by me, as any subsequent invocation might have
different characteristics.

I will remove my development commentaries and create a private
repository at bitbucket for you* to take an early look like Georg (and
more or less Terry, too) suggested. Is that a good way for most of
you? (I would then give access to whomever wants to take a look.)

Best,
--stefan

*: not personally targeted at Guido (who is naturally very much
welcome to take a look, too) but addressed to python-dev in general.


More information about the Python-Dev mailing list