Skip to content

Conversation

@letFunny
Copy link
Collaborator

Remove optimizations from the conflict algorithm in preparation for adding support for prefer.

  • Have you signed the CLA?

@github-actions
Copy link

github-actions bot commented Apr 21, 2025

Command Mean [s] Min [s] Max [s] Relative
BASE 8.345 ± 0.036 8.281 8.396 1.00
HEAD 8.571 ± 0.144 8.430 8.940 1.03 ± 0.02

@letFunny letFunny force-pushed the remove-paths-optimization branch 2 times, most recently from 93a5c5c to b05439b Compare April 21, 2025 09:52
Remove optimizations from the conflict algorithm in preparation for
adding support for prefer.
@letFunny letFunny force-pushed the remove-paths-optimization branch from b05439b to 0e56c51 Compare April 21, 2025 10:00
Copy link
Contributor

@niemeyer niemeyer left a 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.

// 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)
Copy link
Contributor

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:

  1. Make globs be a map[string]bool, just tracking the set of globs, and iterate over paths instead

or maybe even better

  1. 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.

Copy link
Collaborator Author

@letFunny letFunny Apr 22, 2025

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.

@letFunny letFunny added the Priority Look at me first label Apr 22, 2025
@niemeyer niemeyer changed the title feat: simplify conflict algorithm refactor: simplify conflict algorithm Apr 23, 2025
Copy link
Contributor

@niemeyer niemeyer left a 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.

@niemeyer niemeyer merged commit e4a81ab into canonical:main Apr 23, 2025
18 checks passed
@letFunny letFunny deleted the remove-paths-optimization branch April 30, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority Look at me first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants