perf: return least complex marker when building intersection#821
Merged
abn merged 2 commits intopython-poetry:mainfrom Jan 20, 2025
Merged
perf: return least complex marker when building intersection#821abn merged 2 commits intopython-poetry:mainfrom
abn merged 2 commits intopython-poetry:mainfrom
Conversation
Reviewer's Guide by SourceryThis pull request optimizes marker intersection performance by returning the least complex marker representation. This addresses performance regressions observed when intersecting markers. Class diagram for marker hierarchy and operationsclassDiagram
class BaseMarker {
+complexity
+exclude(marker_name)
+only(marker_names)
}
class MultiMarker {
+markers
+exclude(marker_name)
+only(marker_names)
}
class MarkerUnion {
+markers
+exclude(marker_name)
+only(marker_names)
}
BaseMarker <|-- MultiMarker
BaseMarker <|-- MarkerUnion
note for MultiMarker "Modified exclude() to use intersection"
note for MarkerUnion "Modified exclude() to use union"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @radoering - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Hey @radoering - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
cfb877c to
f00b7cb
Compare
2 tasks
This is analogous to what we do when building the union. Although this means extra work, it pays off if the resulting marker is used in another marker operation.
Otherwise, the expectations in the export tests had to be changed due to the previous commit.
f00b7cb to
d5f6120
Compare
abn
approved these changes
Jan 20, 2025
radoering
added a commit
to radoering/poetry-core
that referenced
this pull request
Feb 2, 2025
radoering
added a commit
to radoering/poetry-core
that referenced
this pull request
Feb 2, 2025
2 tasks
radoering
added a commit
to radoering/poetry-core
that referenced
this pull request
Feb 2, 2025
abn
pushed a commit
that referenced
this pull request
Feb 2, 2025
3 tasks
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 is analogous to what we do when building the union. Although this means extra work, it pays off if the resulting marker is used in another marker operation.
Relates to: python-poetry/poetry#9956
The downstream failures are caused by cosmetic changes. The tests are fixed in python-poetry/poetry#10077. We should probably merge this PR with failing downstream tests and switch from the released poetry-core version to the main branch afterwards.
After the simplified repro reported in python-poetry/poetry#9956 (comment) is almost as fast as before (see #818), I took a look at the example from python-poetry/poetry#9956 (comment), which is still significantly slower. With this PR, it is about as fast as before:
Summary by Sourcery
Optimize marker intersection performance by returning the least complex marker representation. This addresses performance regressions observed when intersecting markers.
Bug Fixes:
Tests:
Summary by Sourcery
Optimize marker intersection performance by returning the least complex marker representation.
Bug Fixes:
Tests: