Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: Microbenchmark results:
$ ./python -m perf timeit --compare-to=../cpython-release/python -s 'from itertools import repeat' 'list(repeat(None, 1000000))' /home/serhiy/py/cpython-release/python: ..................... 3.79 ms +- 0.09 ms /home/serhiy/py/cpython-iter/python: ..................... 4.14 ms +- 0.07 ms Mean +- std dev: [/home/serhiy/py/cpython-release/python] 3.79 ms +- 0.09 ms -> [/home/serhiy/py/cpython-iter/python] 4.14 ms +- 0.07 ms: 1.09x slower (+9%) $ ./python -m perf timeit --compare-to=../cpython-release/python -s 'from itertools import cycle, islice' 'list(islice(cycle(range(1000)), 1000000))' /home/serhiy/py/cpython-release/python: ..................... 6.88 ms +- 0.30 ms /home/serhiy/py/cpython-iter/python: ..................... 6.87 ms +- 0.26 ms Mean +- std dev: [/home/serhiy/py/cpython-release/python] 6.88 ms +- 0.30 ms -> [/home/serhiy/py/cpython-iter/python] 6.87 ms +- 0.26 ms: 1.00x faster (-0%) Not significant! $ ./python -m perf timeit --compare-to=../cpython-release/python -s 'from itertools import count, islice' 'list(islice(count(), 1000000))' /home/serhiy/py/cpython-release/python: ..................... 26.1 ms +- 0.6 ms /home/serhiy/py/cpython-iter/python: ..................... 26.3 ms +- 0.6 ms Mean +- std dev: [/home/serhiy/py/cpython-release/python] 26.1 ms +- 0.6 ms -> [/home/serhiy/py/cpython-iter/python] 26.3 ms +- 0.6 ms: 1.01x slower (+1%) Not significant! $ ./python -m perf timeit --compare-to=../cpython-release/python -s 'from itertools import product' 'list(product(range(100), repeat=3))' /home/serhiy/py/cpython-release/python: ..................... 80.2 ms +- 3.2 ms /home/serhiy/py/cpython-iter/python: ..................... 80.2 ms +- 1.7 ms Mean +- std dev: [/home/serhiy/py/cpython-release/python] 80.2 ms +- 3.2 ms -> [/home/serhiy/py/cpython-iter/python] 80.2 ms +- 1.7 ms: 1.00x faster (-0%) Not significant! $ ./python -m perf timeit --compare-to=../cpython-release/python -s 'from itertools import combinations' 'list(combinations(range(23), 10))' /home/serhiy/py/cpython-release/python: ..................... 177 ms +- 14 ms /home/serhiy/py/cpython-iter/python: ..................... 169 ms +- 4 ms Mean +- std dev: [/home/serhiy/py/cpython-release/python] 177 ms +- 14 ms -> [/home/serhiy/py/cpython-iter/python] 169 ms +- 4 ms: 1.05x faster (-4%) The only significant slowdown is for repeat(). But there is possibility to optimize this one by reusing an existing counter. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31815> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com