-
Notifications
You must be signed in to change notification settings - Fork 55
refactor: simplify conflict algorithm #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
93a5c5c to
b05439b
Compare
Remove optimizations from the conflict algorithm in preparation for adding support for prefer.
b05439b to
0e56c51
Compare
niemeyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
niemeyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, let's give this a shot. Curious to see how #204 will look like now.
Remove optimizations from the conflict algorithm in preparation for adding support for prefer.