Jack Diederich <[EMAIL PROTECTED]> added the comment: +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. ---------- nosy: +jackdied _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2260> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com