[issue45026] More compact range iterator

Łukasz Langa report at bugs.python.org
Mon Sep 27 09:25:07 EDT 2021


Łukasz Langa <lukasz at langa.pl> added the comment:

Dennis, run your benchmarks with --rigorous to avoid "Benchmark hidden because not significant".

I note that the second and third benchmarks aren't useful as written because the iterators are exhausted after first repetition. I could see this in my results, note how the values don't rise with the iterator size:

for i in it_10: pass: Mean +- std dev: 25.0 ns +- 0.3 ns
for i in it_100: pass: Mean +- std dev: 25.1 ns +- 0.5 ns
for i in it_1000: pass: Mean +- std dev: 25.0 ns +- 0.3 ns
for i in it_10000: pass: Mean +- std dev: 25.0 ns +- 0.3 ns
for i in it_100000: pass: Mean +- std dev: 25.6 ns +- 0.5 ns

deque(it_10): Mean +- std dev: 334 ns +- 8 ns
deque(it_100): Mean +- std dev: 338 ns +- 9 ns
deque(it_1000): Mean +- std dev: 335 ns +- 9 ns
deque(it_10000): Mean +- std dev: 336 ns +- 10 ns
deque(it_100000): Mean +- std dev: 338 ns +- 11 ns

When I modified those to recreate the iterator on every run, the story was much different.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45026>
_______________________________________


More information about the Python-bugs-list mailing list