Skip to content

Commit ccd09c4

Browse files
committed
meta: Move the Criterion dependency behind a walltime feature
Currently Criterion is always built with the test crates, but it doesn't really need to be. It wasn't a problem before but did start showing up with the latest version bump since it added a C dependency, and for the Miri CI runs we don't have the C toolchains. To resolve this and speed up compilation time, move criterion behind a new feature `walltime`. I'd rather have named this `runtime` but don't want to confuse my future self with "what runtime?".
1 parent 26a67ec commit ccd09c4

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ jobs:
287287
path: ${{ env.BASELINE_NAME }}.tar.xz
288288

289289
- name: Run wall time benchmarks
290-
run: ./ci/bench-runtime.sh
290+
run: ./ci/bench-walltime.sh
291291

292292
- name: Print test logs if available
293293
if: always()

builtins-test/Cargo.toml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ rand_xoshiro.workspace = true
1616
# To compare float builtins against
1717
rustc_apfloat.workspace = true
1818

19-
# Really a dev dependency, but dev dependencies can't be optional
19+
# Really dev dependencies, but those can't be optional
20+
criterion = { workspace = true, optional = true }
2021
gungraun = { workspace = true, optional = true }
2122

2223
[dev-dependencies]
23-
criterion.workspace = true
2424
paste.workspace = true
2525

2626
[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies]
@@ -46,8 +46,10 @@ no-sys-f16 = ["no-sys-f16-f64-convert"]
4646
# Enable icount benchmarks (requires gungraun-runner and valgrind locally)
4747
icount = ["dep:gungraun"]
4848

49-
# Enable report generation without bringing in more dependencies by default
50-
benchmarking-reports = ["criterion/plotters", "criterion/html_reports"]
49+
# Config for wall time benchmarks. Plotters and html_reports bring in extra
50+
# deps so are off by default for CI.
51+
benchmarking-reports = ["walltime", "criterion/plotters", "criterion/html_reports"]
52+
walltime = ["dep:criterion"]
5153

5254
# NOTE: benchmarks must be run with `--no-default-features` or with
5355
# `-p builtins-test`, otherwise the default `compiler-builtins` feature
@@ -57,38 +59,47 @@ benchmarking-reports = ["criterion/plotters", "criterion/html_reports"]
5759
[[bench]]
5860
name = "float_add"
5961
harness = false
62+
required-features = ["walltime"]
6063

6164
[[bench]]
6265
name = "float_sub"
6366
harness = false
67+
required-features = ["walltime"]
6468

6569
[[bench]]
6670
name = "float_mul"
6771
harness = false
72+
required-features = ["walltime"]
6873

6974
[[bench]]
7075
name = "float_div"
7176
harness = false
77+
required-features = ["walltime"]
7278

7379
[[bench]]
7480
name = "float_cmp"
7581
harness = false
82+
required-features = ["walltime"]
7683

7784
[[bench]]
7885
name = "float_conv"
7986
harness = false
87+
required-features = ["walltime"]
8088

8189
[[bench]]
8290
name = "float_extend"
8391
harness = false
92+
required-features = ["walltime"]
8493

8594
[[bench]]
8695
name = "float_trunc"
8796
harness = false
97+
required-features = ["walltime"]
8898

8999
[[bench]]
90100
name = "float_pow"
91101
harness = false
102+
required-features = ["walltime"]
92103

93104
[[bench]]
94105
name = "mem_icount"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
export LIBM_SEED=benchesbenchesbenchesbencheswoo!
77
cargo bench --package libm-test \
88
--no-default-features \
9-
--features short-benchmarks,build-musl,libm/force-soft-floats
9+
--features walltime,short-benchmarks,build-musl,libm/force-soft-floats

libm-test/Cargo.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ license = "MIT OR Apache-2.0"
99
anyhow.workspace = true
1010
# This is not directly used but is required so we can enable `gmp-mpfr-sys/force-cross`.
1111
gmp-mpfr-sys = { workspace = true, optional = true }
12-
gungraun = { workspace = true, optional = true }
1312
indicatif.workspace = true
1413
libm = { workspace = true, default-features = true, features = ["unstable-public-internals"] }
1514
libm-macros.workspace = true
@@ -20,14 +19,17 @@ rand_chacha.workspace = true
2019
rayon.workspace = true
2120
rug = { workspace = true, optional = true }
2221

22+
# Really dev dependencies, but those can't be optional
23+
criterion = { workspace = true, optional = true }
24+
gungraun = { workspace = true, optional = true }
25+
2326
[target.'cfg(target_family = "wasm")'.dependencies]
2427
getrandom = { workspace = true, features = ["wasm_js"] }
2528

2629
[build-dependencies]
2730
rand = { workspace = true, optional = true }
2831

2932
[dev-dependencies]
30-
criterion.workspace = true
3133
libtest-mimic.workspace = true
3234

3335
[features]
@@ -43,8 +45,10 @@ build-mpfr = ["dep:rug", "dep:gmp-mpfr-sys"]
4345
# Build our own musl for testing and benchmarks
4446
build-musl = ["dep:musl-math-sys"]
4547

46-
# Enable report generation without bringing in more dependencies by default
47-
benchmarking-reports = ["criterion/plotters", "criterion/html_reports"]
48+
# Config for wall time benchmarks. Plotters and html_reports bring in extra
49+
# deps so are off by default for CI.
50+
benchmarking-reports = ["walltime", "criterion/plotters", "criterion/html_reports"]
51+
walltime = ["dep:criterion"]
4852

4953
# Enable icount benchmarks (requires gungraun-runner and valgrind locally)
5054
icount = ["dep:gungraun"]
@@ -60,6 +64,7 @@ required-features = ["icount"]
6064
[[bench]]
6165
name = "random"
6266
harness = false
67+
required-features = ["walltime"]
6368

6469
[[test]]
6570
# No harness so that we can skip tests at runtime based on env. Prefixed with

0 commit comments

Comments
 (0)