Message402139
Iterating large integers:
$ ./python -m pyperf timeit -s 'r = range(0, 10**20, 3**35)' 'for i in r: pass'
baseline: Mean +- std dev: 223 us +- 10 us
PR 27986: Mean +- std dev: 128 us +- 4 us
PR 28176: Mean +- std dev: 99.0 us +- 3.7 us
$ ./python -m pyperf timeit -s 'r = range(0, 10**20, 3**35)' 'list(r)'
baseline: Mean +- std dev: 191 us +- 13 us
PR 27986: Mean +- std dev: 107 us +- 7 us
PR 28176: Mean +- std dev: 91.3 us +- 2.4 us
Unpickling:
$ ./python -m pyperf timeit -s 'from pickle import dumps, loads; p = dumps([iter(range(i)) for i in range(1000)])' 'loads(p)'
baseline: Mean +- std dev: 535 us +- 29 us
PR 27986: Mean +- std dev: 420 us +- 15 us
PR 28176: Mean +- std dev: 418 us +- 17 us
$ ./python -m pyperf timeit -s 'from pickle import dumps, loads; p = dumps([iter(range(i*10**10)) for i in range(1000)])' 'loads(p)'
baseline: Mean +- std dev: 652 us +- 37 us
PR 27986: Mean +- std dev: 530 us +- 43 us
PR 28176: Mean +- std dev: 523 us +- 17 us
Seems PR 28176 is slightly faster than PR 27986 in iterating long integers. |
|
Date |
User |
Action |
Args |
2021-09-18 21:32:08 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, lukasz.langa, Dennis Sweeney |
2021-09-18 21:32:08 | serhiy.storchaka | set | messageid: <1632000728.24.0.264440410409.issue45026@roundup.psfhosted.org> |
2021-09-18 21:32:08 | serhiy.storchaka | link | issue45026 messages |
2021-09-18 21:32:08 | serhiy.storchaka | create | |
|