improve performance for merging markers from overrides#10018
Merged
abn merged 1 commit intopython-poetry:mainfrom Jan 11, 2025
Merged
improve performance for merging markers from overrides#10018abn merged 1 commit intopython-poetry:mainfrom
abn merged 1 commit intopython-poetry:mainfrom
Conversation
Reviewer's Guide by SourceryThis pull request improves the performance of merging markers from overrides by changing the Sequence diagram for optimized marker mergingsequenceDiagram
participant S as Solver
participant M as MarkerMerger
participant P as Package
S->>M: merge_override_packages(override_packages)
activate M
M->>M: Group packages by identity
M->>M: Check if markers are same across overrides
alt Markers are same
M->>M: Apply performance shortcut
M->>M: Union override markers once
else Markers differ
M->>M: Apply general algorithm
M->>M: Iteratively merge markers
end
M->>P: Update package dependencies
M-->>S: Return merged packages
deactivate M
Class diagram showing the refactored marker merging structureclassDiagram
class Package {
+requires: List[Dependency]
+add_dependency(dep)
}
class TransitivePackageInfo {
+depth: int
+groups: Set
+markers: Dict
}
class BaseMarker {
+intersect(other)
+union(other)
+without_extras()
}
class Solver {
-_provider: Provider
+_solve_in_compatibility_mode(overrides)
+_solve()
}
Package -- TransitivePackageInfo
TransitivePackageInfo -- BaseMarker
Solver -- Package
note for TransitivePackageInfo "Stores package metadata and markers"
note for BaseMarker "Handles marker operations with improved performance"
Flow diagram of improved marker merging processgraph TD
A[Start] --> B[Collect all packages and overrides]
B --> C{Are markers same\nfor all overrides?}
C -->|Yes| D[Use performance shortcut]
C -->|No| E[Use general algorithm]
D --> F[Union override markers]
F --> G[Intersect with package markers]
E --> H[Iteratively merge markers]
H --> I[Union with existing markers]
G --> J[Update package dependencies]
I --> J
J --> K[End]
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.
dcebda6 to
4ef2df2
Compare
abn
approved these changes
Jan 11, 2025
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Pull Request Check List
Related to: #9956
This is far from fixing the regression reported in #9956. It "just" improves the performance (compared to Poetry 2.0) significantly.
Using the simplified repro from #9956 (comment) (thanks @dimbleby 🙏), Poetry 1.8 can solve it in 0.2 s, no matter if there is only one extra or 14 extras. Poetry 2 takes longer the more extras are defined:
Summary by Sourcery
Tests: