[Python-Dev] AST optimizer implemented in Python (original) (raw)
Hrvoje Niksic hrvoje.niksic at avl.com
Tue Aug 14 17:09:13 CEST 2012
- Previous message: [Python-Dev] AST optimizer implemented in Python
- Next message: [Python-Dev] AST optimizer implemented in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 08/14/2012 03:32 PM, Victor Stinner wrote:
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
AST allows for better high-level optimizations, but a real peephole optimization pass is actually designed to optimize generated code. This allows eliminating some inefficiencies which would be fairly hard to prevent at higher levels - wikipedia provides some examples.
- Previous message: [Python-Dev] AST optimizer implemented in Python
- Next message: [Python-Dev] AST optimizer implemented in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]