Conversation
pradyunsg
approved these changes
May 10, 2025
Contributor
Author
|
@pradyunsg thanks for the review, do you know the best way to advocate to get this PR merged that is respectful of the time/notification inbox of the maintainers? |
cthoyt
commented
May 19, 2025
| if glibc_version in _LEGACY_MANYLINUX_MAP: | ||
| legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version] | ||
| if _is_compatible(arch, glibc_version): | ||
| yield "manylinux_{}_{}_{}".format(*glibc_version, arch) |
Contributor
Author
There was a problem hiding this comment.
this replaces the combination of tag = "manylinux_{}_{}".format(*glibc_version) and yield f"{tag}_{arch}" since these two string format operations are done in succession (without, imo, the intermediate name adding any useful context nor being reused anywhere)
cthoyt
commented
May 19, 2025
| # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags. | ||
| if glibc_version in _LEGACY_MANYLINUX_MAP: | ||
| legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version] | ||
| if _is_compatible(arch, glibc_version): |
Contributor
Author
There was a problem hiding this comment.
the doubled call to _is_compatible is combine
henryiii
approved these changes
May 22, 2025
Contributor
|
Thanks! |
konstin
pushed a commit
to astral-sh/uv
that referenced
this pull request
May 28, 2025
## Summary This PR makes a few performance improvements: 1. Reduces the need to unpack and repack a `_GLibCVersion` tuple 2. Reduces the doubled call to `_is_compatible(arch, glibc_version)` 3. Moves the assignment of the `tag` variable directly into the yield, reducing memory allocation in case this is never used when `_is_compatible(arch, glibc_version)` is false 4. Combines the check of the `glibc_version` being in `_LEGACY_MANYLINUX_MAP` and the assignment to the variable together. I'm not sure if this is actually better, but using the assignment expression reduces this from 4 lines to 2 ## Test Plan I upstreamed these changes in pypa/packaging#869. Otherwise, I'm pretty confident this is a minor change that works the same
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes a few performance improvements:
_is_compatible(arch, glibc_version)tagvariable directly into the yield, reducing memory allocation in case this is never used when_is_compatible(arch, glibc_version)is false