This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients eltoder, mark.dickinson, pitrou, rhettinger
Date 2011-03-11.16:30:52
SpamBayes Score 0.00020136777
Marked as misclassified No
Message-id <1299861053.67.0.552825602522.issue11462@psf.upfronthosting.co.za>
In-reply-to
Content
I'm disinclined to accept this patch.  There is only minor space savings and no actual speed-up.

When constant folding was introduced, a design decision was made to ignore the issue of orphan constants.  The rationale behind that decision still stands.

The peepholer has aspired to be very conservative and is considered a high-risk area for changes.  Since its introduction, Guido has constantly teetered on the edge of entirely ripping out the peepholer.  Right now, the stability of that code is its greatest asset and we should be reluctant to modify it.

Also, the peephole optimizer was developed before the AST branch was added to Python.  Constant folding more properly belongs at the AST level, not in the peepholer itself.  Our strategy is to move as much as possible into an AST optimizer and to stop building out the peephole optimizer.

Right now, the pattern is tokenize -> parse -> AST -> genbytecode -> peephole optimization (which disassembles the bytecode, analyzed it and rewrites it) -> final bytecode.   The correct pattern is tokenize -> parse -> AST -> optimize -> genbytecode -> peephole optimization with minimal disassembly, analysis, and opcode rewrites -> final bytecode.
History
Date User Action Args
2011-03-11 16:30:53rhettingersetrecipients: + rhettinger, mark.dickinson, pitrou, eltoder
2011-03-11 16:30:53rhettingersetmessageid: <1299861053.67.0.552825602522.issue11462@psf.upfronthosting.co.za>
2011-03-11 16:30:53rhettingerlinkissue11462 messages
2011-03-11 16:30:52rhettingercreate