- All playbooks
- Use build profiles to remove expensive work
Use build profiles to remove expensive work
Measure where build time goes, then remove or replace the compiler work or dependencies responsible for the bottleneck.
How companies used this technique
Read what each company changed and follow the original sources.
Remove the compiler work a profile identifies
Codex removed async-trait wrappers from its concrete tool handlers and kept boxing only at the object-safe registry adapter, after a compiler profile showed where rustc spent its time.
Clean codex-core rebuild: rustc total 187.15s to 68.98s Source
- Use it when
- Compiler profiles point to one macro, generic construct or module.
- Before applying it
- Compiler phases overlap, so their timings do not add up. Source refactors need behavior, API, runtime and target checks.
Remove expensive dependencies from the hot build graph
Sorbet replaced a Protobuf-based serialization path with JSON, removed protoc from its main target’s dependency graph, and added a Bazel query to its linters that flags any new path back to protoc.
On a Linux aarch64 developer machine, a debug build of the main target took 3:57.62 before and 2:55.61 after, per the author. Source
- Use it when
- One target repeatedly compiles a large dependency that an equivalent implementation can avoid.
- Before applying it
- Keep public behavior, serialization formats and every required test, and keep a graph check so the dependency stays out.
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