Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-24076: Inline single digit unpacking in the integer fastpath of sum() #28469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 21, 2021

Conversation

scoder
Copy link
Contributor

@scoder scoder commented Sep 20, 2021

This gave me a 17% speedup last time I tried (3 years ago). Most integers that go into sum() should fit into a single PyLong digit, so this seems worth it.

https://bugs.python.org/issue24076

@scoder scoder merged commit debd804 into python:main Sep 21, 2021
@scoder scoder deleted the bpo-24076_faster_int_sum branch September 21, 2021 09:01
niyas-sait pushed a commit to niyas-sait/cpython that referenced this pull request Sep 21, 2021
@pablogsal
Copy link
Member

pablogsal commented Sep 21, 2021

Unfortunately commit debd804 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
.........
test_grammar leaked [12, 12, 12, 12] references, sum=48
test_grammar failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
test_grammar

Total duration: 1.1 sec
Tests result: FAILURE

debd804 is the first bad commit
commit debd804
Author: scoder [email protected]
Date: Tue Sep 21 11:01:18 2021 +0200

[bpo-24076](https://bugs.python.org/issue24076): Inline single digit unpacking in the integer fastpath of sum() (GH-28469)

.../Core and Builtins/2021-09-20-10-02-12.bpo-24076.ZFgFSj.rst | 1 +
Python/bltinmodule.c | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-09-20-10-02-12.bpo-24076.ZFgFSj.rst

pablogsal added a commit to pablogsal/cpython that referenced this pull request Sep 21, 2021
@pablogsal
Copy link
Member

Opened #28493 to fix the refleak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants