[issue23553] Reduce the number of comparison for range checking.

Raymond Hettinger report at bugs.python.org
Sun Mar 1 09:36:42 CET 2015


Raymond Hettinger added the comment:

I think the source in listobject.c would be benefit from a well-named macro for this.  That would provide the most clarity.   For deques, I'll just put in the simple patch because it only applies to a place that is already doing unsigned arithmetic/comparisons.

FWIW, I don't usually use benchmarking on these kinds of changes.  The generated assembler is sufficiently informative.   Benchmarking each tiny change risks getting trapped in a local minimum.  Also, little timeit tests tend to branch the same way every time (which won't show the cost of prediction misses) and it tends to have all code and data in cache (so you don't see the effects of cache misses) and it risks tuning to a single processor (in my case a haswell).   Instead, I look at the code generated by GCC and CLang to see that it does less work.

----------

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


More information about the Python-bugs-list mailing list