ITADN

Bug: Nextest runs bnechmark tests really slowly

#3117ClosedJP-Ellis 创建于 2026-03-01
bug
J
JP-Elliscommented
### Description of the issue I am using the [criterion](https://github.com/criterion-rs/criterion.rs) benchmarking tool, and the number of tests is rather large due to iterating over a number of input sizes. When Criterion benchmarks run, Criterion will run a number of warm-up iterations (either based on duration, or number count, depending on how fast a loop actually is). Typically, the warm up will be ~3s per test. This is very slow, but acceptable to ensure proper benchmarking. When the benchmarks are tested through `cargo test`, the tests run very fast. I suspect because there is no warm up, and only a single loop of the iteration. When the benchmarks are tested through `cargo nextest`, the same tests are now very slow, often taking a few seconds each. It would nearly seem like Nextest is causing the benchmarks to run though their warm up cycles. To be clear, this is not a minor difference in performance. It is a nearly 10x slow down in my particular case: ``` ❯ time cargo test --benches cargo test --benches 18.57s user 0.30s system 90% cpu 20.773 total ❯ time cargo nextest run --benches cargo nextest run --benches 149.69s user 61.34s system 183% cpu 1:55.21 total ``` This is testing both standard unit tests, and benchmarks. If I focus entirely on a benchmark, the timings show this too[^1]: ``` cargo test push_front/LinkedList/5 --benches 0.27s user 0.12s system 86% cpu 0.449 total cargo nextest run push_front/LinkedList/5 --benches 1.61s user 0.68s system 175% cpu 1.305 total ``` [^1]: In fact, the entirety of `cargo test` runs faster than the faster of the individual tests run through nextest. ### Expected outcome Both `cargo test` and `nextest` should run at similar speeds, or ideally, `nextest` be faster. ### Actual result Nextest results in a 10x slowdown. ### Nextest version ```text cargo-nextest 0.9.129 (1358a2296 2026-02-22) release: 0.9.129 commit-hash: 1358a22964df2595d30d830ad669b37093e4a732 commit-date: 2026-02-22 host: aarch64-apple-darwin ``` ### Additional context _No response_
关闭于 2026-03-08 5 条评论