- All playbooks
- Slow tests
- Reduce repeated process and build-graph startup
Reduce repeated process and build-graph startup
Batch compatible test work or share its build graph to avoid paying process startup and initialization for every file or target.
How companies used this technique
Read what each company changed and follow the original sources.
Run reliable test files in one parallel invocation per shard
Each Bun test shard now runs its fast, historically reliable test files as one bun test --parallel batch, an invocation that distributes the files across a pool of worker processes, where each file used to start its own process. Files that have shown batch sensitivity go on a denylist and run on their own, and so do memory-measuring tests.
Per-lane test shard time for the whole change (batching, the full core count on test agents and one up-front addon build per shard), one main build against one branch build: debian x64-asan 8.5 to 4.9 minutes on average (42% lower), windows 2019 x64 8.6 to 6.0 minutes (30%), darwin 26 aarch64 15.5 to 12.6 minutes (19%). Source
- Use it when
- Process startup for each test file takes a large share of a big suite, and a reviewed set of files shares no mutable state.
- Before applying it
- Files in unlisted directories stay on the per-file path, and a new test file in a listed directory joins the batch; the batch reports every file it runs, and any error in the batch turns the job red.
Run tests in fewer processes
Codex moved every integration test under tests/ into one suite, so cargo builds and starts a single test binary. The Python SDK compiles its dependency-policy checker once per pytest worker and runs each of its policy cases in-process with fresh globals, keeping real subprocess tests for CLI parity.
Python 3.14 test job: 7m00s to 2m41s (2m24s before the policy matrix landed) Source
- Use it when
- A suite repeatedly starts interpreters, CLIs or separate test binaries.
- Before applying it
- Sharing a process can expose leaked state and environment changes. Keep tests isolated and compare results as well as runtime.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed