[issue11462] Peephole creates duplicate and unused constants

Eugene Toder report at bugs.python.org
Fri Mar 11 23:31:09 CET 2011


Eugene Toder <eltoder at gmail.com> added the comment:

Thomas, can you clarify, does loading interns all constants in co_consts, or do you mean that they are mostly small numbers and the like?

Without interning I think that in-memory size difference is even bigger than on-disk, as you get one entry in tuple and the object itself. I'm sure I can cook up a test that will show some perf difference, because of cache misses or paging. You can say that this is not real world code, and you will likely be right. But in real world (before you add inlining and constant propagation) constant folding doesn't make a lot of difference too, yet people asked for it and peepholer does it. Btw, Antoine just improved it quite a bit (Issue11244), so size difference with my patch should increase.

My rationale for the patch is that 1) it's real very simple 2) it removes feeling of half-done job when you look at the bytecode.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11462>
_______________________________________


More information about the Python-bugs-list mailing list