refactor: simplify conflict algorithm#216
Merged
niemeyer merged 4 commits intocanonical:mainfrom Apr 23, 2025
Merged
Conversation
|
93a5c5c to
b05439b
Compare
Remove optimizations from the conflict algorithm in preparation for adding support for prefer.
b05439b to
0e56c51
Compare
niemeyer
requested changes
Apr 21, 2025
Contributor
niemeyer
left a comment
There was a problem hiding this comment.
This is looking promising, thanks Alberto.
internal/setup/setup.go
Outdated
| // cannot validate that they are the same without downloading the package. | ||
| paths := make(map[string]*Slice) | ||
| paths := make(map[string][]*Slice) | ||
| globs := make(map[string]*Slice) |
Contributor
There was a problem hiding this comment.
It's a somewhat suspect that we're still tracking the target slice here. In theory, this should be a list just like paths. On the other hand, we already have paths itself tracking the slices, so we could:
- Make globs be a map[string]bool, just tracking the set of globs, and iterate over paths instead
or maybe even better
- Not have globs at all, and instead iterate on paths and test for GeneratePath / GlobPath on the globs iteration itself.
I would try (2), check for performance impact, and if okay go with it, as it's simpler and required less data again.
Collaborator
Author
There was a problem hiding this comment.
I have tried (2) and according to the CI there is no impact on performance. Probably the only thing missing is a comment in the code.
1 task
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.
Remove optimizations from the conflict algorithm in preparation for adding support for prefer.