- All playbooks
- Precompile repeated imports in disposable test copies
Precompile repeated imports in disposable test copies
Compile repeated imports once per test shard when every test subprocess runs with bytecode writes off.
Company examples
How OpenAI used this technique
Read what OpenAI changed and follow the original sources.
Precompile repeated imports in disposable test copies
Codex Security runs compileall with checked hashes on each shard's disposable copy of the package. Release artifacts keep the original archive, and the isolated subprocesses keep their no-write flags.
Paired local Linux run of the 43 scan-resume cases: 451.7s to 381.7s, plus 1.1s of preparation Source
- Use it when
- Tests launch many isolated interpreters with bytecode writes disabled.
- Before applying it
- Generated bytecode stays out of release artifacts. Hash-based invalidation, interpreter compatibility and the real no-write tests remain necessary.
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