Repository navigation
Profile the core test suite and build the installer fixture once per file - #239
Merged
Merged
Conversation
Profiling the core suite on macOS (Node 26.8.2, 12 cores) showed test/install.test.ts was the single most expensive file that spent its time on redundant setup rather than on the behavior under test: each of its six release() calls re-ran scripts/build.ts and npm pack, producing byte-identical inputs. Those six build+pack pairs were about 8.7s of the file's 11.2s. Build and pack once per file and reuse the tarball bytes. Every test still serves the freshly packed tarball over its own HTTP server and installs it into its own prefix, so the fresh-installed-package and separate-process coverage is unchanged; only the repeated identical build and pack are removed. The corrupt variant only ever altered the SHA256SUMS digest, not the tarball, so it shares the same bytes. Measured on macOS 15 (darwin 25.6.0), Node 26.8.2, 12 cores, warm npm cache, three runs each: test/install.test.ts alone: 11.19-12.21s -> 3.51-3.58s full `npm test` wall: 36.03-40.65s -> 34.09-35.52s Not verified: Windows. These are local macOS numbers and do not establish what the change does to the Windows core job in CI, which is where #234's 4m56s was observed. The wall-clock figures above are a 12-core parallel run and are noisy; the per-file figure is the reliable one. Not changed: no test was converted from a spawned process to an in-process call, no CLI coverage was dropped, and no OS or Node matrix entry was touched. Sharding was not attempted. Refs #234. Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd
force-pushed
the
claude/issue-234-test-profile
branch
from
September 20, 2026 05:29
97d118b to
356d523
Compare
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.
Investigation for #234. Measurement first; the change is one targeted consolidation.
What was measured, and where
macOS 15 (darwin 25.6.0), Node 26.8.2, 12 cores, warm npm cache, local checkout after
npm ci. These are not Windows numbers and do not establish Windows behavior. #234's 4m56s came from one Windows CI run, not a controlled benchmark, and nothing here reproduces that environment.Method: every
child_processentry point was intercepted with amodule.registerHooksresolve hook redirectingnode:child_processto a timing shim, then the suite was run (a) whole and in parallel, and (b) one file at a time, recording per-test durations and every child process with its duration.Where the time actually goes
582 tests across 83 files. Summed over per-file solo runs: 188.6s. Parallel
npm testrunner duration: 36-41s.src/cli.tsspawnsMeasured CLI startup floor (median of 7):
node -e ''import()of thesrc/cli.tsmodule graph, no command runsrc/cli.ts --helpdist/cli.js --helpsrc/cli.ts routes --project starters/defaultNegative result: repeated CLI startup is not dominant
The suspected cause is real but small. 110 spawns x the 186 ms floor is ~20.5s, about 11% of the 188.6s sequential total. Of that floor, TypeScript stripping is only ~57 ms (186 vs. 129 for the built CLI); the remaining ~160 ms is the module graph itself. Uncontended CLI invocations cost ~200-380 ms each, so most of a spawn is startup — but there are not enough of them for it to be the story.
Three of the four slowest files barely spawn anything:
extensions.test.tsis 29 tests at a ~200 ms in-process floor each — project loading and compilation inside the test process, not spawning. That is where a future optimization would have to look.The packed-package smoke (
scripts/package-smoke.ts) runs one pack and one install; locally it is 9.2s. There is no redundant setup in it to remove — its CI cost is npm install and tsc on the runner's filesystem.The one change
install.test.tswas the outlier: 11.2s of its 11.4s was child processes, and sixrelease()calls each re-ranscripts/build.ts+npm packfor byte-identical output (~8.7s of the file). Build and pack once per file, reuse the bytes.Coverage retained. Every test still serves the freshly packed tarball over its own HTTP server and installs it into its own prefix via the real
install.sh. No test was converted from a spawned process to an in-process call. No CLI or OS/Node matrix coverage was touched. Thecorruptvariant only ever altered the SHA256SUMS digest, never the tarball, so sharing bytes is sound.Before / after (three runs each, same machine, same session)
test/install.test.tsalonenpm testrunner durationThe per-file number is the reliable one. The parallel wall figure is noisy on 12 cores and the ranges overlap at the edges; read it as a few seconds, not as a headline. An earlier cold-cache first run measured 61.5s — that was a cold
dist/, and it is excluded above rather than used to claim a 26s win.Sharding
Assessed, not attempted. The suite is throughput-bound, not tail-bound: the longest single file is 13.8s against a 188.6s total, so splitting across runners would help, but that is a CI-topology change and should follow its own measurement on Windows rather than ride on this.
#202
Not folded in. The Windows auth-store worker startup timeout is a separate open question about
packages/auth, not about this suite, and nothing measured here establishes it as a performance-only issue.Verified
npm run lint,npm run typecheck,npm run check, fullnpm test(581 pass, 1 skipped, 0 fail) on macOS. Windows was not run.🤖 Generated with Claude Code