Skip to content

spice: Batch branch state and head loading - #1489

Merged
abhinav merged 1 commit into
storage-batch-readsfrom
batch-branch-loading
Oct 25, 2026
Merged

abhinav merged 1 commit into
storage-batch-readsfrom
batch-branch-loading

Conversation

@abhinav

@abhinav abhinav commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Loading tracked branches runs individual state and head lookups in a
worker pool, starting Git processes for every branch.
Load their state through Store.LookupBranches and GetMany, and
resolve requested local heads in one filtered for-each-ref call.
The worker pool is no longer needed to overlap state and head lookups.

Expose ordered Service.LookupBranches results with branch-specific
errors and make singular service and store lookups specialize their
batch APIs.
Propagate MissingKeysError indexes with successful state responses
so branch classification needs no individual rereads.
Unexpected storage failures abort the batch.
Share metadata interpretation, upstream verification, and deleted-branch
handling with the existing lookup path.

Local branch filters select literal names and slash-delimited prefixes,
as used by branch lookup and sync deletion.
If filter arguments exceed the Linux, macOS, or Windows process limit,
retry without filters and match literal prefixes locally.
Retry only before any branch has been emitted,
preserving ordering and worktree metadata.

On the macOS arm64 demo repository with 103 local branches, hyperfine
uses 3 warmups and 15 runs of log short and log long, each with
--all --json.
Compared with the parent storage-support commit:

Listing Parent mean +/- SD (s) New mean +/- SD (s)
Short 1.601 +/- 0.299 1.550 +/- 0.353
Long 1.816 +/- 0.343 1.253 +/- 0.221

The short-listing difference is within the observed variation.

Loading tracked branches runs individual state and head lookups in a
worker pool, starting Git processes for every branch.
Load their state through `Store.LookupBranches` and `GetMany`, and
resolve requested local heads in one filtered `for-each-ref` call.
The worker pool is no longer needed to overlap state and head lookups.

Expose ordered `Service.LookupBranches` results with branch-specific
errors and make singular service and store lookups specialize their
batch APIs.
Propagate `MissingKeysError` indexes with successful state responses
so branch classification needs no individual rereads.
Unexpected storage failures abort the batch.
Share metadata interpretation, upstream verification, and deleted-branch
handling with the existing lookup path.

Local branch filters select literal names and slash-delimited prefixes,
as used by branch lookup and sync deletion.
If filter arguments exceed the Linux, macOS, or Windows process limit,
retry without filters and match literal prefixes locally.
Retry only before any branch has been emitted,
preserving ordering and worktree metadata.

On the macOS arm64 demo repository with 103 local branches, hyperfine
uses 3 warmups and 15 runs of `log short` and `log long`, each with
`--all --json`.
Compared with the parent storage-support commit:

| Listing | Parent mean +/- SD (s) | New mean +/- SD (s) |
| --- | ---: | ---: |
| Short | 1.601 +/- 0.299 | 1.550 +/- 0.353 |
| Long | 1.816 +/- 0.343 | 1.253 +/- 0.221 |

The short-listing difference is within the observed variation.
@abhinav

abhinav commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner Author

@abhinav
abhinav added this pull request to stack #1482 October 25, 2026 21:30
@abhinav
abhinav merged commit 5495647 into main Oct 25, 2026
22 checks passed
@abhinav
abhinav deleted the batch-branch-loading branch October 25, 2026 22:12
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