[issue21422] int << 0: return the number unmodified
STINNER Victor
report at bugs.python.org
Sun May 4 00:41:29 CEST 2014
STINNER Victor added the comment:
> I would think that in real-world code, this branch will almost never be
taken. The common case will pay a price (albiet a small one) for almost
zero benefit.
I think that x << 0 is common even if it's not written like that (it's more
for i in range(8): ... x << i).
The benefit is to reduce the memory footprint.
Can you sow the overhead of the branch in a microbenchmark? The test is
only done once, it's out of a loop.
*If* it's possible to notice an overhead, we can maybe use GCC macro
unlikely().
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21422>
_______________________________________
More information about the Python-bugs-list
mailing list