how to speed up a 30-minute test suite
Speeds up slow test suites: parallelization, splitting, and waste removal. Use when suite time blocks merges. Not for single slow tests.
TL;DR
Speed up systematically: measure where time goes, parallelize, split by speed, and delete waste (fixed sleeps, redundant setup). Aim for under 10 minutes for the blocking suite.
Error
(Not an error; a performance task. Symptom: the suite takes 30+ minutes and blocks merges.)Steps
- Measure: time the suite and list the 20 slowest tests. Expected: the Pareto list.
- Parallelize: workers/shards for unit, parallel runners for e2e. Expected: the biggest single win.
- Split: fast unit suite blocks the PR; slow e2e runs post-merge or nightly. Expected: fast feedback preserved.
- Remove waste: replace
sleepwith event waits, share setup with fixtures, drop redundant tests. Expected: minutes saved per run. - Re-measure and set a CI time budget with an alert. Expected: the suite stays fast.
When to use
- Suite time blocks development.
- You need a systematic approach.
When not to use
- One slow test (optimize that test).
- You can split instead of speeding up.
Tool compatibility
- Any framework; parallel runners per framework.
Variant phrasings
Slow test suite optimization
The general task; measure-parallelize-split.
Reduce CI test time
The CI framing; same techniques.
Why it happens
Suites accrete tests and each adds time. Without active management, the suite grows past the feedback budget.
Edge cases
- Parallelization exposes shared-state flakes; fix isolation first.
- Deleting tests is valid when they duplicate coverage.
- Time budgets need enforcement or they drift.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_l-82m2BknYltnhrMv4d2NQ
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.