perf(cli): apply bundle via git fetch + git merge --ff-only#317
Closed
worstell wants to merge 1 commit into
Closed
perf(cli): apply bundle via git fetch + git merge --ff-only#317worstell wants to merge 1 commit into
worstell wants to merge 1 commit into
Conversation
Replaces `git pull --ff-only <bundle> <branch>` in cachew git restore's bundle-apply path with an explicit `git fetch` + `git merge --ff-only FETCH_HEAD` pair. `git pull` runs two implicit subcommands that add no value for a one-shot bundle apply: - `git rev-list --objects --stdin --not --exclude-hidden=fetch --all` (connectivity check across all local refs) - `git maintenance run --auto` (background gc/repack heuristic) — can trigger surprise pack rewrites during a hot bootstrap path The new path also emits separate cachew.git_fetch_seconds and cachew.git_merge_seconds span attributes so future work can attribute bundle-apply cost between fetch vs working-tree update. Measured on a staging cachew-bench workstation against squareup/cash-server (5.5 GiB snapshot, 290 KiB bundle, 13 commits ahead): bundle-apply wall-clock improves ~300ms (14.95s -> 14.41s median over 3 runs). The cold `git merge` itself dominates bundle apply cost on a fresh extract; this PR is mainly about predictability and instrumentation, not raw wall-clock. Amp-Thread-ID: https://ampcode.com/threads/T-019e41af-0a15-718d-a9d8-e26df6071f9b Co-authored-by: Amp <amp@ampcode.com>
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.
Replaces
git pull --ff-only <bundle> <branch>in cachew git restore's bundle-apply path with an explicitgit fetch+git merge --ff-only FETCH_HEADpair.Why
git pullruns two implicit subcommands that add no value for a one-shot bundle apply:git rev-list --objects --stdin --not --exclude-hidden=fetch --all— connectivity check across all local refsgit maintenance run --auto— background gc/repack heuristic; can trigger surprise pack rewrites during a hot bootstrap pathObservability
Emits separate
cachew.git_fetch_secondsandcachew.git_merge_secondsspan attributes so future work can attribute bundle-apply cost between fetch vs working-tree update. Today the working-tree update (coldgit mergeon a fresh tar-extracted repo) dominates by ~30x.Measured impact
On a staging cachew-bench workstation against squareup/cash-server (5.5 GiB snapshot, 290 KiB bundle, 13 commits ahead):
~300 ms wall-clock; the rest is the cold
git mergeitself reading every stat-dirty index entry on the fresh extract. This PR is mainly about predictability and instrumentation — the headline cold-merge cost needs a separate (server-side) fix.