Message304591
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. |
|
Date |
User |
Action |
Args |
2017-10-18 18:11:40 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, ncoghlan |
2017-10-18 18:11:40 | serhiy.storchaka | set | messageid: <1508350300.89.0.213398074469.issue31815@psf.upfronthosting.co.za> |
2017-10-18 18:11:40 | serhiy.storchaka | link | issue31815 messages |
2017-10-18 18:11:40 | serhiy.storchaka | create | |
|