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.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com