[Python-Dev] AST optimizer implemented in Python (original) (raw)

Kristján Valur Jónsson kristjan at ccpgames.com
Tue Aug 14 12:25:52 CEST 2012


-----Original Message----- 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.

Then I stumbled upon this project: http://code.google.com/p/byteplay/ Sounds like just the ticket, disassemble the code, do transformations on it, then reassemble. Haven't gotten further than that though :)

K



More information about the Python-Dev mailing list