[Python-Dev] Python 3 optimizations... (original) (raw)

stefan brunthaler stefan at brunthaler.net
Fri Jul 23 20:34:16 CEST 2010


wpython has reached 1.1 final version. If you are interested, you can find it here: http://code.google.com/p/wpython2/ and you can download the new slides that cover the improvements over 1.0 alpha. Thanks for the hint, I will definitely check your new slides.

Did you used wpython wordcode format, or a new one? No, actually I was well into working on my stuff when you announced wpython last year. My latest instruction format uses a native machine word (64bit) that contains two 32bit halves with the opcode in the lower half and the operand in the upper half. While the opcode certainly does not exceed 10bits or so, I need more than a byte to support more operations (my latest interpreter has 395 instructions). Our instruction decoding is almost identical, though.

Yes, you're right. wpython approach is to encode as much information as it can to save space, decoding time, "specialize" some opcodes, etc.. Yes, I see that wpython eliminates common instruction sequences. From my understanding, it corresponds to using static superinstructions in combination with a changed instruction format. Aside of the optimizations in the operation implementation wpython allows to eliminate some instruction dispatches, which are notoriously inefficient. I think it is a very nice approach and some form of inline caching with quickening might well boost performance even more.

Cheers, --stefan



More information about the Python-Dev mailing list