fixedbitset icon indicating copy to clipboard operation
fixedbitset copied to clipboard

Move tests to a cfg(test) module

Open james7132 opened this issue 2 years ago • 1 comments

Moves all tests to their own module that is hidden behind a #[cfg(test)], should speed up compilation time.

james7132 avatar Jun 24 '22 08:06 james7132

How are you measuring build time?

I don't see a difference:

➜  fixedbitset git:(master) hyperfine  -- "cargo clean && cargo build --lib --release"
Benchmark 1: cargo clean && cargo build --lib --release
  Time (mean ± σ):     589.9 ms ±  48.1 ms    [User: 585.7 ms, System: 85.2 ms]
  Range (min … max):   516.3 ms … 648.9 ms    10 runs
➜  fixedbitset git:(master) hyperfine  -- "cargo clean && cargo build --lib"
Benchmark 1: cargo clean && cargo build --lib
  Time (mean ± σ):     617.7 ms ±  40.6 ms    [User: 540.6 ms, System: 120.5 ms]
  Range (min … max):   568.1 ms … 660.0 ms    10 runs
➜ gco james7132/cfg-test
➜ fixedbitset git:(79253bf) hyperfine  -- "cargo clean && cargo build --lib"
Benchmark 1: cargo clean && cargo build --lib
  Time (mean ± σ):     619.1 ms ±  46.7 ms    [User: 536.7 ms, System: 119.6 ms]
  Range (min … max):   523.7 ms … 681.8 ms    10 runs
➜  fixedbitset git:(79253bf) hyperfine  -- "cargo clean && cargo build --lib --release"
Benchmark 1: cargo clean && cargo build --lib --release
  Time (mean ± σ):     602.4 ms ±  43.0 ms    [User: 594.2 ms, System: 86.3 ms]
  Range (min … max):   536.3 ms … 658.0 ms    10 runs

jrraymond avatar Jun 24 '22 21:06 jrraymond

Those tests seem to include the IO bottleneck of running cargo clean. Using https://doc.rust-lang.org/cargo/reference/timings.html might show some closer differences.

james7132 avatar Dec 23 '22 19:12 james7132

Oh --timings is new. That's quite helpful.

jrraymond avatar Jan 08 '23 03:01 jrraymond