Oren Milman added the comment:
I looked at the assembly, and saw maybe_small_long is not inlined, but I agree
that other compilers (or future compilers) might introduce some optimization
that would elide the check.
Also, as expected (thanks to branch prediction, I guess), a little
microbenchmark shows my patch doesn't improve performance:
without my patch:
python.exe -m perf timeit "122 >> 2"
....................
Median +- std dev: 20.5 ns +- 0.5 ns
python.exe -m perf timeit "215 << 1"
....................
Median +- std dev: 20.6 ns +- 0.5 ns
with my patch:
python.exe -m perf timeit "122 >> 2"
....................
Median +- std dev: 20.6 ns +- 0.3 ns
python.exe -m perf timeit "215 << 1"
....................
Median +- std dev: 20.6 ns +- 0.4 ns
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28272>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com