-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-42161: mathmodule.c: move _PyLong_GetOne() loop invariant #26391
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
Conversation
Move _PyLong_GetZero() and _PyLong_GetOne() loop invariants outside loops in functions: * math.comb() * math.gcd() * math.lcm() * math.perm()
This change should be backport to 3.10 since it fix a minor performance regression introduced in Python 3.10: https://bugs.python.org/issue42161#msg388988 |
cc @rhettinger |
I didn't notice that _PyLong_GetZero() and _PyLong_GetOne() were used in loops in Modules/mathmodule.c when I wrote my commit 3783413 (I tried to pay attention to that, to avoid performance regression). |
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
GH-26393 is a backport of this pull request to the 3.10 branch. |
Thanks for the review @erlend-aasland. |
Move _PyLong_GetZero() and _PyLong_GetOne() loop invariants outside
loops in functions:
https://bugs.python.org/issue42161