perf(markers): speed up _format_marker and benchmark str(Marker) - #1371
Open
notatallshaw wants to merge 3 commits into
Open
perf(markers): speed up _format_marker and benchmark str(Marker)#1371notatallshaw wants to merge 3 commits into
notatallshaw wants to merge 3 commits into
Conversation
notatallshaw
marked this pull request as draft
August 8, 2026 18:09
notatallshaw
force-pushed
the
perf/format-marker
branch
from
August 8, 2026 18:13
9b9d3c8 to
81bf16e
Compare
Member
Author
|
Faster: |
notatallshaw
marked this pull request as ready for review
August 8, 2026 18:20
henryiii
reviewed
Aug 10, 2026
Contributor
|
By the way, here or as a followup, we could do #1252 on Marker, which would cut the repeated |
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Member
Author
As a complete aside, I've been thinking of adding a class method calls |
Contributor
|
What about supporting |
Contributor
|
All benchmarks:
|
henryiii
approved these changes
Aug 10, 2026
notatallshaw
added a commit
to notatallshaw/nab
that referenced
this pull request
Aug 17, 2026
- relation is proposed upstream now; the marker-item serialisation is pypa/packaging#1371 - every vendored import uses the from form, so the removal plan needs one rule - prepare_environment and evaluate_prepared are 26.4
notatallshaw
added a commit
to notatallshaw/nab
that referenced
this pull request
Aug 17, 2026
The private helper names, the SortedOrder alias and release_intervals all differ from what the fork's drafts carry, and _format_marker is not pypa/packaging#1371's. Say so, and extend the removal plan to the vendor job and the references a search-replace cannot reach.
notatallshaw
added a commit
to notatallshaw/nab
that referenced
this pull request
Aug 20, 2026
- relation is proposed upstream now; the marker-item serialisation is pypa/packaging#1371 - every vendored import uses the from form, so the removal plan needs one rule - prepare_environment and evaluate_prepared are 26.4
notatallshaw
added a commit
to notatallshaw/nab
that referenced
this pull request
Aug 20, 2026
The private helper names, the SortedOrder alias and release_intervals all differ from what the fork's drafts carry, and _format_marker is not pypa/packaging#1371's. Say so, and extend the removal plan to the vendor job and the references a search-replace cannot reach.
notatallshaw
added a commit
to notatallshaw/nab
that referenced
this pull request
Aug 21, 2026
- relation is proposed upstream now; the marker-item serialisation is pypa/packaging#1371 - every vendored import uses the from form, so the removal plan needs one rule - prepare_environment and evaluate_prepared are 26.4
notatallshaw
added a commit
to notatallshaw/nab
that referenced
this pull request
Aug 28, 2026
- relation is proposed upstream now; the marker-item serialisation is pypa/packaging#1371 - every vendored import uses the from form, so the removal plan needs one rule - prepare_environment and evaluate_prepared are 26.4
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.
_format_markerbacksstr(Marker), and through itMarker.__hash__,Marker.__eq__andRequirement.__str__." ".join([m.serialize() for m in marker])f"{lhs.serialize()} {op.serialize()} {rhs.serialize()}"isinstance(marker, list)(list, tuple, str),(list, tuple)inner(_format_marker(m, first=False) for m in marker)[_format_marker(m, first=False) for m in marker]A marker item is always
(Variable | Value, Op, Variable | Value), so the comprehension and the join are avoidable._format_markertakes about 0.75x the time it did, on CPython 3.10, 3.12, 3.14 and 3.15.TimeMarkerSuitetimed the constructor andevaluatebut notstr, so ASV had no view of this path.time_stradds one.I started looking at this while reading #1370.