[issue24076] sum() several times slower on Python 3 64-bit

2021-09-22 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Always happy to help :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-22 Thread Stefan Behnel
Stefan Behnel added the comment: Sorry for that, Pablo. I knew exactly where the problem was, the second I read your notification. Thank you for resolving it so quickly. -- ___ Python tracker

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 1c7e98dc258a0e7ccd2325a1aefc4aa2de51e1c5 by Pablo Galindo Salgado in branch 'main': bpo-24076: Fix reference in sum() introduced by GH-28469 (GH-28493) https://github.com/python/cpython/commit/1c7e98dc258a0e7ccd2325a1aefc4aa2de51e1c5

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Sorry, I meant PR 28493 -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Opened #28493 to fix the refleak -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +26888 pull_request: https://github.com/python/cpython/pull/28493 ___ Python tracker ___

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Unfortunately commit debd80403721b00423680328d6adf160a28fbff4 introduced a reference leak: ❯ ./python -m test test_grammar -R : 0:00:00 load avg: 2.96 Run tests sequentially 0:00:00 load avg: 2.96 [1/1] test_grammar beginning 9 repetitions 123456789

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you again Stefan. Now no doubts are left. BTW, pyperf gives more stable results. I use it if have any doubts (either the results of timeit are not stable or the difference is less than say 10%). -- ___

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Stefan Behnel
Change by Stefan Behnel : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: Old, with PGO: $ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 1))' 'sum(d)' 1000 loops, best of 5: 340 usec per loop $ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 1))' 'sum(d)' 2000 loops, best of 5: 114 usec per loop $ ./python -m

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: Hmm, thanks for insisting, Serhiy. I was accidentally using a debug build this time. I'll make a PGO build and rerun the microbenchmarks. -- ___ Python tracker

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you. Could you please test PGO builds? -- ___ Python tracker ___ ___ Python-bugs-list

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: Original: $ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 1))' 'sum(d)' 500 loops, best of 5: 712 usec per loop $ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 1))' 'sum(d)' 2000 loops, best of 5: 149 usec per loop $ ./python -m timeit -s

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Stefan Behnel
Change by Stefan Behnel : -- Removed message: https://bugs.python.org/msg402301 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: Original: $ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 1))' 'sum(d)' 500 loops, best of 5: 712 usec per loop $ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 1))' 'sum(d)' 2000 loops, best of 5: 149 usec per loop $ ./python -m timeit -s

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What are microbenchmark results for PR 28469 in comparison with the baseline? -- ___ Python tracker ___

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: New changeset debd80403721b00423680328d6adf160a28fbff4 by scoder in branch 'main': bpo-24076: Inline single digit unpacking in the integer fastpath of sum() (GH-28469) https://github.com/python/cpython/commit/debd80403721b00423680328d6adf160a28fbff4

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Guido van Rossum
Guido van Rossum added the comment: Sounds good, you have my blessing. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Stefan Behnel
Stefan Behnel added the comment: > The patch looks fine, but it looks a bit like benchmark chasing. Is the speed > of builtin sum() of a sequence of integers important enough to do this bit of > inlining? Given that we already accepted essentially separate loops for the int, float and

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Guido van Rossum
Guido van Rossum added the comment: The patch looks fine, but it looks a bit like benchmark chasing. Is the speed of builtin sum() of a sequence of integers important enough to do this bit of inlining? (It may break if we change the internals of Py_Long, as Mark Shannon has been wanting to

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I created a PR from my last patch, inlining the unpacking > of single digit integers. Thanks, that gets to the heart of the issue. I marked the PR as approved (though there is a small coding nit you may want to fix). --

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Stefan Behnel
Stefan Behnel added the comment: I created a PR from my last patch, inlining the unpacking of single digit integers. Since most integers should fit into a single digit these days, this is as fast a path as it gets. https://github.com/python/cpython/pull/28469 -- versions: +Python

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Stefan Behnel
Change by Stefan Behnel : -- pull_requests: +26868 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/28469 ___ Python tracker ___

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: > OTOH on my Mac I still find that 3.10 with PGO is still > more than twice as slow than 2.7. > Thinking about it that's a bit odd, since (presumably) > the majority of the work in sum() involves a long int result > (even though the values returned by

[issue24076] sum() several times slower on Python 3 64-bit

2021-09-18 Thread Guido van Rossum
Guido van Rossum added the comment: @Stefan > FWIW, a PGO build of Py3.7 is now about 20% *faster* here than my Ubuntu > 16/04 system Python 2.7 Does that mean we can close this issue? Or do I misunderstand what you are comparing? 32 vs. 64 bits? PGO vs. non-PGO? OTOH on my Mac I still

[issue24076] sum() several times slower on Python 3 64-bit

2018-08-12 Thread Antoine Pitrou
Change by Antoine Pitrou : -- nosy: -pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue24076] sum() several times slower on Python 3 64-bit

2018-08-12 Thread Stefan Behnel
Stefan Behnel added the comment: FWIW, a PGO build of Py3.7 is now about 20% *faster* here than my Ubuntu 16/04 system Python 2.7, and for some (probably unrelated) reason, the system Python 3.5 is another 2% faster on my side. IMHO, the only other thing that seems obvious to try would be

[issue24076] sum() several times slower on Python 3 64-bit

2017-04-11 Thread Louie Lu
Changes by Louie Lu : -- title: sum() several times slower on Python 3 -> sum() several times slower on Python 3 64-bit ___ Python tracker