Skip to content

perf: use a custom trie for path conflict validation#302

Open
letFunny wants to merge 6 commits into
canonical:mainfrom
letFunny:performance-tree
Open

perf: use a custom trie for path conflict validation#302
letFunny wants to merge 6 commits into
canonical:mainfrom
letFunny:performance-tree

Conversation

@letFunny

Copy link
Copy Markdown
Collaborator
  • Have you signed the CLA?

@letFunny letFunny force-pushed the performance-tree branch 3 times, most recently from d4113ef to b8da2e8 Compare June 10, 2026 11:29
@letFunny letFunny requested a review from Copilot June 10, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Introduces a trie-based conflict detector for slice path collisions and expands tests to cover more glob/double-glob conflict cases.

Changes:

  • Replaced the O(n²) glob/generate conflict scan in Release.validate() with a pathConflictTree-based detector.
  • Added extensive regression tests for glob conflicts and new focused unit tests for the conflict tree/segmenter.
  • Exposed internal conflict-tree types/helpers to external tests via export_test.go.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
internal/setup/setup.go Switches validation to the new conflict-tree implementation.
internal/setup/conflict.go Adds trie-based conflict detection and path segmentation logic.
internal/setup/setup_test.go Adds multiple new test cases for glob/double-glob conflicts.
internal/setup/conflict_test.go Adds unit tests for pathToSegments and the conflict tree structure.
internal/setup/export_test.go Exports internal symbols to support setup_test package tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict_test.go Outdated
@letFunny letFunny requested a review from Copilot June 12, 2026 08:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict.go
Comment thread internal/setup/conflict.go Outdated
Comment thread internal/setup/conflict.go Outdated
Comment thread internal/setup/conflict.go
@letFunny letFunny marked this pull request as ready for review June 12, 2026 08:46
@letFunny

Copy link
Copy Markdown
Collaborator Author

After some very light work on performance to improve the algorithm without added complexity (basically caching some data to avoid map lookups, iteration order, etc. *) the performance is:

Benchmark 1: BASE
  Time (mean ± σ):     11.011 s ±  0.034 s    [User: 11.412 s, System: 0.053 s]
  Range (min … max):   10.952 s … 11.063 s    10 runs
 
Benchmark 2: HEAD
  Time (mean ± σ):     252.5 ms ±   6.1 ms    [User: 271.7 ms, System: 19.7 ms]
  Range (min … max):   245.5 ms … 268.7 ms    11 runs
 
Summary
  'HEAD' ran
   43.61 ± 1.07 times faster than 'BASE'

*: All verified to reduce the number of cache misses using perf which is why the time also improves reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants