This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients gvanrossum, lukasz.langa, mark.dickinson, rhettinger, scoder, serhiy.storchaka, steven.daprano
Date 2021-09-21.11:21:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632223309.34.0.625426294169.issue24076@roundup.psfhosted.org>
In-reply-to
Content
Old, with PGO:
$ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 10000))' 'sum(d)'
1000 loops, best of 5: 340 usec per loop
$ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 10000))' 'sum(d)'
2000 loops, best of 5: 114 usec per loop
$ ./python -m timeit -s 'd = list(range(2**29, 2**29 + 10000))' 'sum(d)'
5000 loops, best of 5: 73.4 usec per loop
$ ./python -m timeit -s 'd = list(range(10000))' 'sum(d)'
5000 loops, best of 5: 73.3 usec per loop
$ ./python -m timeit -s 'd = [0] * 10000' 'sum(d)'
5000 loops, best of 5: 78.7 usec per loop


New, with PGO:
$ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 10000))' 'sum(d)'
1000 loops, best of 5: 305 usec per loop
$ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 10000))' 'sum(d)'
2000 loops, best of 5: 115 usec per loop
$ ./python -m timeit -s 'd = list(range(2**29, 2**29 + 10000))' 'sum(d)'
5000 loops, best of 5: 52.4 usec per loop
$ ./python -m timeit -s 'd = list(range(10000))' 'sum(d)'
5000 loops, best of 5: 54 usec per loop
$ ./python -m timeit -s 'd = [0] * 10000' 'sum(d)'
5000 loops, best of 5: 45.8 usec per loop

The results are a bit more mixed with PGO optimisation (I tried a couple of times), not sure why. Might just be normal fluctuation, bad benchmark value selection, or accidental PGO tuning, can't say. In any case, the 1-digit case (10000, 2**29) is again about 28% faster and none of the other cases seems (visibly) slower.

I think this is a very clear net-win.
History
Date User Action Args
2021-09-21 11:21:49scodersetrecipients: + scoder, gvanrossum, rhettinger, mark.dickinson, steven.daprano, lukasz.langa, serhiy.storchaka
2021-09-21 11:21:49scodersetmessageid: <1632223309.34.0.625426294169.issue24076@roundup.psfhosted.org>
2021-09-21 11:21:49scoderlinkissue24076 messages
2021-09-21 11:21:49scodercreate