[issue36791] sum() relies on C signed overflow behaviour
Serhiy Storchaka
report at bugs.python.org
Sat May 4 09:52:41 EDT 2019
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
I tested few cases (all positive, all negative, mixed), and did not found any performance difference after this change.
./python -m perf timeit -s "a = list(range(10**4))" -- "sum(a)"
./python -m perf timeit -s "a = [-i for i in range(10**4)]" -- "sum(a)"
./python -m perf timeit -s "a = [i*(-1)**i for i in range(10**4)]" -- "sum(a)"
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36791>
_______________________________________
More information about the Python-bugs-list
mailing list