Skip to content
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

gh-129149: Add Missing fast path in PYLONG_FROM_UINT macro for compact integers #129168

Merged
merged 21 commits into from
Jan 23, 2025

Conversation

srinivasreddy
Copy link
Contributor

@srinivasreddy srinivasreddy commented Jan 22, 2025

@srinivasreddy srinivasreddy changed the title Add Missing fast path in PyLong_From*() functions for compact integers gh-129149: Add Missing fast path in PyLong_From*() functions for compact integers Jan 22, 2025
@skirpichev

This comment was marked as resolved.

@srinivasreddy srinivasreddy marked this pull request as ready for review January 22, 2025 09:06
@skirpichev skirpichev self-requested a review January 22, 2025 09:34
srinivasreddy and others added 2 commits January 22, 2025 15:16
…e-129149.wAYu43.rst

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
…e-129149.wAYu43.rst

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Objects/longobject.c Outdated Show resolved Hide resolved
Copy link
Member

@skirpichev skirpichev left a 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.

Objects/longobject.c Outdated Show resolved Hide resolved
Objects/longobject.c Outdated Show resolved Hide resolved
Copy link
Member

@picnixz picnixz left a 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.

Objects/longobject.c Outdated Show resolved Hide resolved
@srinivasreddy srinivasreddy requested a review from picnixz January 23, 2025 06:22
@srinivasreddy srinivasreddy marked this pull request as draft January 23, 2025 06:45
@srinivasreddy srinivasreddy changed the title gh-129149: Add Missing fast path in PyLong_From*() functions for compact integers gh-129149: Add Missing fast path PYLONG_FROM_UINT macro for compact integers Jan 23, 2025
@srinivasreddy srinivasreddy changed the title gh-129149: Add Missing fast path PYLONG_FROM_UINT macro for compact integers gh-129149: Add Missing fast path in PYLONG_FROM_UINT macro for compact integers Jan 23, 2025
@srinivasreddy srinivasreddy marked this pull request as ready for review January 23, 2025 06:56
@srinivasreddy
Copy link
Contributor Author

srinivasreddy commented Jan 23, 2025

Action plan for PRs.

  1. Add Missing fast path in PYLONG_FROM_UINT macro for compact integers gh-129149: Add Missing fast path in PYLONG_FROM_UINT macro for compact integers #129168
  2. Refactor PyLong_FromSsize_t(), PyLong_FromLong() and PyLong_FromLongLong() using a macro similar to PYLONG_FROM_UINT to get rid of the repetitive code.

cc @skirpichev @picnixz

Copy link
Member

@skirpichev skirpichev left a 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 commit af410e0.
@srinivasreddy
Copy link
Contributor Author

@skirpichev Done.

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit and LGTM.

…e-129149.wAYu43.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@srinivasreddy
Copy link
Contributor Author

@picnixz Done 👍🏾

Copy link
Member

@picnixz picnixz left a 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.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…e-129149.wAYu43.rst

Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner vstinner enabled auto-merge (squash) January 23, 2025 14:36
@vstinner vstinner merged commit ab353b3 into python:main Jan 23, 2025
41 checks passed
@vstinner
Copy link
Member

Merged, thanks @srinivasreddy!

@srinivasreddy srinivasreddy deleted the gh-129149 branch January 23, 2025 15:49
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.

7 participants