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 jackdied
Recipients _doublep, jackdied
Date 2008-08-01.03:43:13
SpamBayes Score 0.25441968
Marked as misclassified No
Message-id <1217562196.11.0.281268296469.issue2260@psf.upfronthosting.co.za>
In-reply-to
Content
+0

* The peepholer comment promises "Optimizations are restricted to simple
transformations occuring within a single basic block." and this goes
beyond that.  You could patch that comment.
* This needs a matching patch to Lib/test/test_peepholer.py
* Deeply nested "if"s suffer a flat penalty because the unconditional
jump peepholer figures this out after the first extra POP_TOP (notice
the JUMP_ABSOLUTE in your second disassembly).
* I noticed the NOP assignment is commented out in your patch, was that
unsafe?

I searched for old threads on the peephole optimizer and came up with these:
Skip Montanaro's paper
  http://www.webfast.com/~skip/python/spam7/optimizer.html
Two old python-dev threads
  http://www.gossamer-threads.com/lists/python/dev/645669
  http://www.gossamer-threads.com/lists/python/dev/645669

I was hoping to find out if writing a bytecode optimizer in python had
been discussed because a generic version of your optimization would be
really easy to write in pure python (using a dict for the jump table,
for instance).  I found nothing;  my search terms might have been
insufficient.
History
Date User Action Args
2008-08-01 03:43:16jackdiedsetrecipients: + jackdied, _doublep
2008-08-01 03:43:16jackdiedsetmessageid: <1217562196.11.0.281268296469.issue2260@psf.upfronthosting.co.za>
2008-08-01 03:43:15jackdiedlinkissue2260 messages
2008-08-01 03:43:13jackdiedcreate