Today, there was a significant check-in to the peephole optimizer that I think
should be reverted:
http://hg.python.org/cpython/rev/14205d0fee45/
The peephole optimizer pre-dated the introduction of the abstract syntax tree.
Now that we have an AST, the preferred way to implement additional
optimizations is with AST manipulation, upstream from code generation. This
approach is faster and much more reliable than the more brittle approach of
disassembling, analyzing, and rewriting the bytecode created by the compiler.
There should no longer be any significant changes to the existing optimizer.
It took a good deal of care to get it right in the first place. The code is
stable and has been proven successful by many years of deployment. The nature
of the peephole optimizer is that changes to it are high risk, that the
procedure is brittle, and that it is easily mucked-up in ways that are hard to
detect. Accordingly, we've kept to simple conservative transformations and have
assiduously avoided more complex (and interesting) optimizations.
FWIW, I've been the maintainer (as well as the original designer and
implementer) of the peephole optimizer from the beginning; however, today's
committer did not accept my advice to be very conservative with changes to it
and to strongly prefer AST transformations instead. Please consider reverting
this change.
Raymond
_______________________________________________
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