Skip to content

Commit 52d7701

Browse files
committed
Use a more lightweight benchmarking library
Criterion is a slow and giant dependency that pulls in more giant dependencies. There is no particularly compelling reason to use it here over a more lightweight implementation, and removing it also improves test build times by 25% (because all dev-dependencies are built in both bench and test modes and there is no way to control this; see rust-lang/cargo#1596). This also actually runs the tests for the ‘handwritten’ bench implementation and fixes a test failure.
1 parent a52d4a4 commit 52d7701

File tree

7 files changed

+269
-323
lines changed

7 files changed

+269
-323
lines changed

Cargo.toml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0"
1111
publish = false # Use `release.sh`
1212
documentation = "https://docs.rs/modular-bitfield"
1313
repository = "https://github.com/Robbepop/modular-bitfield"
14-
rust-version = "1.56.0"
14+
rust-version = "1.66.0"
1515
version = "0.12.0-pre"
1616

1717
[package]
@@ -28,43 +28,32 @@ publish.workspace = true
2828
repository.workspace = true
2929
rust-version.workspace = true
3030
version.workspace = true
31+
autobenches = false
3132

3233
[dependencies]
3334
modular-bitfield-impl = { path = "impl", version = "0.12.0-pre" }
3435
static_assertions = "1.1"
3536

3637
[dev-dependencies]
37-
# To run benchmarks, these packages need to be present, but until
38-
# <https://github.com/rust-lang/cargo/issues/1596> is fixed, there is no way to
39-
# have conditional dev-dependencies. Criterion is a fat dependency with its own
40-
# fat dependencies and this causes dev builds to take longer than they need to.
41-
# Until the benches can be rewritten to use libtest or similar just disable
42-
# building these crates, since they are practically never used. (Using a regular
43-
# conditional feature would work, but that would cause this feature and these
44-
# packages to show up as optional runtime dependencies, which they never
45-
# actually are.)
46-
# bitfield = "0.19"
47-
# criterion = "0.5"
38+
bitfield = "0.19"
39+
tiny-bench = "0.4"
4840
trybuild = "1.0"
4941

5042
[[bench]]
5143
name = "benchmarks"
52-
path = "benches/benchmarks.rs"
5344
harness = false
5445

5546
[[bench]]
5647
name = "cmp_handwritten"
57-
path = "benches/cmp_handwritten.rs"
5848
harness = false
5949

6050
[[bench]]
6151
name = "cmp_bitfield_crate"
62-
path = "benches/cmp_bitfield_crate.rs"
6352
harness = false
6453

65-
[[bin]]
66-
name = "playground"
67-
path = "playground.rs"
54+
[[test]]
55+
name = "benches_handwritten"
56+
path = "benches/utils/handwritten.rs"
6857

6958
[profile.bench]
7059
codegen-units = 1

0 commit comments

Comments
 (0)