Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-129149: Add Missing fast path in PYLONG_FROM_UINT macro for compact integers#129168
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
…IGNED. And also added a blurb about the changes
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…e-129149.wAYu43.rstCo-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
…e-129149.wAYu43.rstCo-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…e-129149.wAYu43.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, but I second on comment on declarations in *_FROM_SIGNED. Also, I don't think that PYLONG_FROM_UINT should be moved.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If the code was only moved around and there's no new fast path, I would prefer to do it in a separate PR rather than in this one.
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
srinivasreddy commentedJan 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Action plan for PRs.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
No, you misread me. Refactoring change (conversion PyLong_FromLongLong and PyLong_FromLong to macro) doesn't require a news entry. But this change - does.
This reverts commitaf410e0.
@skirpichev Done. |
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nit and LGTM.
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…e-129149.wAYu43.rstCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz Done 👍🏾 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This looks fine but I'll@vstinner have a look as I'm not very familiar with this performance part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
Misc/NEWS.d/next/Core_and_Builtins/2025-01-22-14-24-44.gh-issue-129149.wAYu43.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…e-129149.wAYu43.rstCo-authored-by: Victor Stinner <vstinner@python.org>
ab353b3 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Merged, thanks@srinivasreddy! |
| /* Count the number of Python digits. */ \ | ||
| Py_ssize_tndigits=0; \ | ||
| INT_TYPEt= (ival); \ | ||
| Py_ssize_tndigits=2; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Depending on theINT_TYPE the value of ndigits can only be 2 or 3. We can replace the while loop with a single if statement. E.g.
main...eendebakpt:cpython:fast_digit_count
@srinivasreddy Would you be interested in benchmarking this approach and making a PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes. Absolutely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
or 3
I do not think this works on a platform where e.g.long long is 128 bit? Or forPYLONG_BITS_IN_DIGIT=15 andlong long being 64bit?
Maybe both hypothetical, but not impossible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Correct. We would need some guards for that. Whether that bit of complexity is worth is, depends on the benchmark results.
Uh oh!
There was an error while loading.Please reload this page.