Skip to content

hide() for simple commit-walk #2037

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

Merged
merged 4 commits into from
Jun 4, 2025
Merged

hide() for simple commit-walk #2037

merged 4 commits into from
Jun 4, 2025

Conversation

Byron
Copy link
Member

@Byron Byron commented Jun 3, 2025

The long version of this got lost in a gh tool hickup, so in short:

  • have only three tests, but these are all that's needed to know it works.
    • it can probably use more to assure it works in conjunction with sorting, etc.,
      but maybe the code can be made so it can't be wrong.
  • fully backwards compatible
  • Using a graph data structure it might be possible to fully cache results and speed-up
    future walks.

Tasks

  • "the" 3 tests
  • implementation
  • the same tests but with sorting enabled
  • hookup to gix commit-graph list for perf testing
    • figure out a way to abort early (even if it means not handling certain special cases well, probably abort if there are only uninteresting)
  • make available in gix

Performance

linux ( master) +798 -408 [!]
❯ hyperfine '/Users/byron/dev/github.com/Byron/gitoxide/target/release/gix commit-graph list -l v6.7..v6.8' 'git log v6.7..v6.8 --oneline'
Benchmark 1: /Users/byron/dev/github.com/Byron/gitoxide/target/release/gix commit-graph list -l v6.7..v6.8
  Time (mean ± σ):     277.0 ms ±   1.5 ms    [User: 261.2 ms, System: 12.7 ms]
  Range (min … max):   274.9 ms … 279.2 ms    10 runs

Benchmark 2: git log v6.7..v6.8 --oneline
  Time (mean ± σ):     267.4 ms ±   6.9 ms    [User: 235.1 ms, System: 28.5 ms]
  Range (min … max):   261.3 ms … 286.2 ms    11 runs

Summary
  git log v6.7..v6.8 --oneline ran
    1.04 ± 0.03 times faster than /Users/byron/dev/github.com/Byron/gitoxide/target/release/gix commit-graph list -l v6.7..v6.8
gitoxide ( hide) [$?⇕⇡4⇣3] took 41s
❯ hyperfine './target/release/gix commit-graph list -l v0.42.0..v0.44.0' 'git log --oneline v0.42.0..v0.44.0'
Benchmark 1: ./target/release/gix commit-graph list -l v0.42.0..v0.44.0
  Time (mean ± σ):       9.5 ms ±   1.2 ms    [User: 4.3 ms, System: 2.7 ms]
  Range (min … max):     8.0 ms …  15.8 ms    233 runs

Benchmark 2: git log --oneline v0.42.0..v0.44.0
  Time (mean ± σ):      14.2 ms ±   1.4 ms    [User: 7.1 ms, System: 5.2 ms]
  Range (min … max):    12.5 ms …  21.5 ms    138 runs

Summary
  ./target/release/gix commit-graph list -l v0.42.0..v0.44.0 ran
    1.50 ± 0.24 times faster than git log --oneline v0.42.0..v0.44.0

@Byron Byron force-pushed the hide branch 3 times, most recently from b9bc096 to aa97988 Compare June 4, 2025 08:50
Byron added 3 commits June 4, 2025 14:51
That means, these tips and all their ancestors will be hidden from
the traversal.
Now it will abort early if there are only hidden tips to be traversed, which
cannot change the result anymore.
This finally makes safe traversals possible and is what most people would want to use
instead of `boundary()`.
@Byron Byron marked this pull request as ready for review June 4, 2025 12:56
@Byron Byron enabled auto-merge June 4, 2025 13:02
@Byron Byron merged commit 92febae into main Jun 4, 2025
25 checks passed
@Byron Byron deleted the hide branch June 4, 2025 13:49
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.

1 participant