Skip to content

Commit 6562166

Browse files
committed
Misc: Hide criterion behind a flag to shorten CI time
1 parent 0039c86 commit 6562166

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.github/workflows/bench.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
override: true
2424

2525
- name: Run benchmark
26+
env:
27+
RUSTFLAGS: "--cfg bench"
2628
run: cargo bench --all-features -- --output-format bencher | tee output.txt
2729

2830
- name: Store benchmark result

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@ aiff_text_chunks = []
4141
riff_info_list = []
4242

4343
[dev-dependencies]
44-
criterion = { version = "0.4.0", features = ["html_reports"] }
4544
# WAV properties validity tests
4645
hound = { git = "https://github.com/ruuda/hound.git", rev = "02e66effb33683dd6acb92df792683ee46ad6a59" }
4746
# tag_writer example
4847
structopt = { version = "0.3.26", default-features = false }
4948
tempfile = "3.3.0"
5049

50+
# Pretty heavy dependency, we don't want this compiling for test/doc runs
51+
[target.'cfg(bench)'.dev-dependencies]
52+
criterion = { version = "0.4.0", features = ["html_reports"] }
53+
5154
[lib]
5255
bench = false
5356

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ cargo run --example custom_resolver
3535

3636
Available [here](https://docs.rs/lofty)
3737

38+
## Benchmarking
39+
40+
There are benchmarks available [here](./benches).
41+
42+
These benchmarks make use of [criterion](https://github.com/bheisler/criterion.rs), and
43+
due to its size it cannot be a normal dev-dependency. To run the benchmarks do:
44+
45+
```shell
46+
RUSTFLAGS="--cfg bench" cargo bench
47+
```
48+
3849
## License
3950

4051
Licensed under either of

0 commit comments

Comments
 (0)