[issue26722] Fold compare operators on constants (peephole)

STINNER Victor report at bugs.python.org
Sat Apr 9 09:19:14 EDT 2016


STINNER Victor added the comment:

> Do you have any numbers on how common constant comparisons are in real code?

In my experience, it almost never occur in real application. But it's common when you start with a constant propogation optimization:

* https://faster-cpython.readthedocs.org/optimizations.html#constant-propagation
* https://fatoptimizer.readthedocs.org/en/latest/optimizations.html#constant-propagation

If you extend constant propagation to things like os.name, it's even more common, but it requires to specialize the code, to disable optimization if os.name is modified (that's one feature provided by FAT Python).

----------

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


More information about the Python-bugs-list mailing list