[Python-Dev] Python 3 optimizations continued...
Ned Batchelder
ned at nedbatchelder.com
Thu Sep 1 13:29:45 CEST 2011
On 8/30/2011 4:41 PM, stefan brunthaler wrote:
>> 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.
When the switchover to the new instruction format happens, what happens
to sys.settrace() tracing? Will it report the same sequence of line
numbers? For a small but important class of program executions, this is
more important than speed.
--Ned.
> Best,
> --stefan
More information about the Python-Dev
mailing list