Repository navigation
SWF(perf): walk visibility history with one git log pass - #644
Closed
beardthelion wants to merge 1 commit into
Closed
beardthelion wants to merge 1 commit into
beardthelion wants to merge 1 commit into
Conversation
Contributor
|
Caution Review failedThe pull request is closed. Walkthrough
|
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.
Clones and fetches on repos with hidden paths start a lot faster. Listing the blobs to withhold on this repo's history went from 7.9 s to 67 ms.
The old walk ran
git ls-treeonce per commit to collect every (oid, path) pair the node has to hide. That's one process per commit, so cost grew with history length. The new walk gets the same pairs from a singlegit log --raw -zpass invisibility_pack.rs.How it works
git log --rawprints each file a commit added or changed against its parent. The walk follows every parent and diffs each merge against its first parent, so a file that only shows up in a merge resolution still gets caught. Subtree and root-tree pairs stay in for the object walk. Output is NUL-delimited, so paths with spaces, newlines, quotes or leading dashes parse as-is.Behavior change: a cyclic graft or replace history now errors out. The old walk returned a partial list there, which could leak. Non-commit refs and the windowed sweep didn't change.
Correctness
If the walk misses a pair, a hidden file leaks.
raw_history_matches_ls_tree_snapshotsbuilds fixture repos and checks that the new set matches the oldls-treeset exactly. Fixtures cover merge-only resolutions, side branches, renames, deletes, gitlinks, nested and empty trees, odd paths, detached HEAD and shallow boundaries.Benchmark
Method: a Rust test harness timed the old and new code on the Gitlawb/node checkout (1,759 reachable commits, 196 merges). Each variant got one warm-up and five measured runs on an 8-vCPU Xeon (Ubuntu, Git 2.56.0, Rust 1.99.1, unoptimized test profile). This times visibility enumeration only. Pack generation and network transfer aren't included.
Try it
cargo test --locked -p twigpine-node --lib raw_history_matches_ls_tree_snapshotsNot tested
The tests on
maindon't compile until #643 lands, so CI here will be red until then. There are five unrelated errors, for examplecannot find function 'read_caller_key' in this scopeandmissing field 'trusted_peers' in initializer of 'IpRateLimiter'. The 71 tests above ran with this patch on91c24ae, the parent ofmain. Clippy and the full workspace suite haven't run for the same reason.Summary by CodeRabbit