Repository navigation
perf: name origin's default branch once per claim operation - #1099
Merged
Merged
Conversation
A reservation named origin's default branch three times, two git processes each: once for its fetch and twice in judge, once for the default branch's records and once to ask whether there was one. A view named it twice: for those records and for the generated files. A drain makes both on every move, and in one drain test these lookups were about a tenth of its 1,107 git processes. judge now resolves the name once, after the act's fetch, and hands it to defaultRecords; a view resolves it once and reads the generated files under it through generatedFilesAt, the exported GeneratedFiles keeping its form. The name is never carried across a fetch, which can create or move origin/HEAD, and every operation resolves it afresh, so a default branch that changes is seen at the next one. Tests pin a reservation at two lookups, one each side of its fetch, and a view at one; the drain test falls to 1,019 git processes. Refs: iss-2610180545134593 Assisted-by: Claude:claude-opus-5-5
Review notes: the reservation test said a reservation names the default branch twice, no more, but that holds where origin holds no other reservation; with others there, the crowding check's view names it once more after the same fetch. It also gave the old count as five, where the case it measures made three. The comment and the failure text now say both. Refs: iss-2610180545134593 Assisted-by: Claude:claude-opus-5-5
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.
What this changes
A claim operation names origin's default branch fewer times. Each lookup is two git processes (
symbolic-refoforigin/HEAD, thenrev-parse --verify), and a drain makes reservations and views on every move.judgeresolves the name once, after the reservation's fetch, and hands it todefaultRecords. It used to resolve it twice, once for the default branch's records and once to ask whether there was a default branch.viewOfresolves it once and reads the generated files under that name through a new unexportedgeneratedFilesAt. The exportedGeneratedFileskeeps its form.Scope of the name. It is passed down explicitly and lives for one operation; there is no package variable. It is never carried across a fetch, because git 2.48 and later can create or move
origin/HEADon a fetch (remote.<name>.followRemoteHEAD). Every operation resolves it afresh, so a default branch that changes is seen at the next one. A side effect: the records and the "no default branch" message injudgenow come from one reading, where two readings could disagree if another process fetched between them.Measured on one drain test in
internal/core/implement/loop: 1,107 git processes before, 1,019 after.This is the first of two claim changes for the loop package's subprocess-bound tests. The second reads a view's reservation tips in one batch and follows as its own pull request.
Evidence
internal/core/claim/calls_test.go) pin a reservation at 2 lookups and a view at 1. A reviewer reverted a copy to the old code, and both tests failed (3 and 2).make preflightpassed on this commit (receipt minted).Refs: iss-2610180545134593
Assisted-by: Claude:claude-opus-5-5