next.js
0e728ca7 - Turbopack: shrink slow tests under Miri (#102135)

Commit
9 hours ago
Turbopack: shrink slow tests under Miri (#102135) ### What? Shrinks the inputs of the slowest Turbopack unit tests when they run under Miri. Native test inputs are unchanged. ### Why? The `test cargo unit (miri)` job runs the explicit package list in `packages/next-swc/package.json` (`turbo-persistence`, `turbo-rcstr`, `turbo-tasks-malloc`). In a recent run it took 1292s. The individual test times added up to about 5387s, and a few tests had inputs sized for native runs but executed in the Miri interpreter, which made the job wait on a long tail: | Test | Miri time on CI | | --- | --- | | `batch_get_misses_outside_last_sst_range` (2 cases) | ~1240s | | `merge_iter::tests::test_matches_sorting` | ~690s | | the two compaction tombstone tests | ~270–300s each | | `batch_get_callback_*` (4 cases) | ~115s each | | `memory_usage_is_reported_and_tracks_a_large_allocation` | ~86s | ### How? The Miri-only reductions follow the existing `cfg(miri)` patterns in these crates: - `batch_get_misses_outside_last_sst_range` runs only its small key count under Miri, which stays below the parallel threshold. `callback_test_batch_sizes()` already does the same. - The two compaction tombstone tests share a key count: 200 under Miri, 2000 natively. With temporary instrumentation I checked natively that 200 keys select the same compactions as 2000, so the tests still compact. - The `batch_get` callback tests build their database with fewer keys under Miri. - `test_matches_sorting` runs one random round per input count under Miri, still for every input count from 1 to 19. - The memory usage test uses a 4 MiB allocation under Miri. Under Miri, `memory_usage()` uses allocation-based accounting rather than committed memory, so 4 MiB is still well above the per-thread counter buffering. ### Verification - The `test-cargo-unit-miri` command from `packages/next-swc/package.json` passed locally (156 passed, 1 skipped) in 157s on an 8-core x86 machine. The slowest test now takes about 59s. This is a local measurement, not a paired comparison with the CI runner. - `cargo nextest run -p turbo-persistence -p turbo-tasks-malloc` passed natively (214 tests). - `cargo fmt --check` and `cargo clippy --tests -- -D warnings` passed for both crates. <!-- NEXT_JS_LLM --> <!-- fleet 36841b1c-28c0-4160-8907-567f8f2ccb60 --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Author
Parents
Loading