[Python-Dev] AST optimizer implemented in Python
Victor Stinner
victor.stinner at gmail.com
Tue Aug 14 15:32:13 CEST 2012
2012/8/14 Kristján Valur Jónsson <kristjan at ccpgames.com>:
>> I moved the script to a new dedicated project on Bitbucket:
>> https://bitbucket.org/haypo/astoptimizer
>>
>> Join the project if you want to help me to build a better optimizer!
>>
>> It now works on Python 2.5-3.3.
>
> I had the idea (perhaps not an original one) that peephole optimization would be much better
> done in python than in C. The C code is clunky and unwieldly, wheras python would be much
> better suited, being able to use nifty regexes and the like.
>
> The problem is, there exists only bytecode disassembler, no corresponding assembler.
Why would you like to work on bytecode instead of AST? The AST
contains much more information, you can implement better optimizations
in AST. AST is also more convinient than bytecode.
Victor
More information about the Python-Dev
mailing list