Repository navigation
perf: compile-check reads the names of the plan only when a run compiles or needs them - #3350
Conversation
…piles or needs the names The name index read every source of the assemblies with references in the plan at the start of each run. A run that compiled nothing and asked no verdict for names waited for that read anyway, and on a large project the read was longer than the rest of such a run. The saved generator output is still read before anything compiles, since a compile removes it. The sources are now read from the first full compile (a hook on the compiler, so the read overlaps csc) or the first verdict that needs names, whichever comes first. The VibeLog name_index entry gains sources_read.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…ged files A run whose only work was a changed-files check started reading the sources when a named verdict asked for them, after the check, so the read no longer overlapped anything. The hook now also runs right before the worker checks (not when the last check of the same edit is replayed), and is renamed for the compiler work it marks. The reported name index duration is now the time each read took, measured from its own start; it used to count the time the run spent before asking for the sources.
8de6940
into
feature/compile-check-changed-files-check
Summary
compile-checkno longer reads the names of the assemblies in the plan on runs that never use them. A run that compiles nothing and leaves every dependent out because its references kept their surface now finishes without that read.User Impact
The name index from #3348 read the sources of every assembly with references in the plan at the start of every run, and every run waited for that read before returning. On a large project where one assembly is referenced directly by 67 others, a no-change run of 0.83 s spent 0.33 to 0.49 s waiting for the read. In alternating pairs against the build before #3348, a no-change run went from 0.25 s to 0.58 s, and the whole difference was the read. Runs that only replay recorded results now skip the read, so they should be back near their earlier time. A run that compiles, or has the worker check changed files, still reads the names, but it does so while that work runs.
Changes
name_indexentry gainssources_read.docs/vibe-logs.mdanddocs/compile-check.mddescribe when the names are read.Verification
TestCompileUnitsReadsNoSourcesWhenNothingCompilesAndEveryVerdictIsKept: a replayed run with kept verdicts never touches a dependent's source. The source points at a missing file, so any read would count as unreadable.TestCompileUnitsReadsTheSourcesWhenAReplayedVerdictNamesAChangeTestCompileUnitsReadsTheSourcesOnceAUnitCompilesInFullTestReuseOrCompileCallsTheCompilerWorkHookOnlyBeforeACompileOrACheck: covers full compile, replay, changed-files check, and replayed check.TestNameIndexReportCountsOnlyTheTimeSpentReading: the one timing assertion. It waits 300 ms before asking for the sources and expects under 150 ms.TestNameIndexWaitReturnsAtOnceWhenTheSourcesWereNeverAsked: the source is a FIFO that no writer ever opens.sources_read: false.TestNameIndexReadsGeneratedCodeBeforeStartReturnsnow starts the source read only after the generated directory has been removed.startalso starts reading the sources (the old behaviour)...ReadsNoSourcesWhenNothingCompiles...fails (Unreadable: 1,SourcesRead: true);...WaitReturnsAtOnce...fails (held 5 s)lookupdoes not start the read...ReadsTheSourcesWhenAReplayedVerdictNamesAChangehangs on the wait, and the run with-timeout 30sfails with a timeoutreuseOrCompile[check])[hook])start[compile hook])...ReadsTheSourcesOnceAUnitCompilesInFullfailscommon,dispatcher,project-runner,release-automation):gofmt -l,go vet,golangci-lint runandgo test ./...;go test ./internal/architecture/...inrelease-automation;go test -race -count=1 ./internal/compilecheck/... ./internal/dispatcher/...indispatcher;scripts/check-code-complexity.shandscripts/check-file-length.sh.go vet, and golangci-lint reports 0 issues in each.go testpasses indispatcherandrelease-automation, including architecture. The race run, complexity and file length all pass. Incommonandproject-runnerone test each fails; both tests are unchanged and fail only inside the local sandbox, which blocks file ownership reads and connect.name_index.gois 427 lines.