Skip to content

Commit 5619eed

Browse files
committed
chore(criterion_compat): adapt criterion fork to run in the monorepo
Signed-off-by: not-matthias <[email protected]>
1 parent ef19d8d commit 5619eed

File tree

8 files changed

+91
-83
lines changed

8 files changed

+91
-83
lines changed

Cargo.lock

Lines changed: 57 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
members = [
33
"crates/codspeed",
44
"crates/bencher_compat",
5-
"crates/criterion_compat",
65
"crates/cargo-codspeed",
76

7+
"crates/criterion_compat",
8+
"crates/criterion_compat/criterion-0.5.1",
9+
810
"crates/divan_compat",
911
"crates/divan_compat/macros",
1012
"crates/divan_compat/divan_fork",
@@ -16,3 +18,4 @@ resolver = "2"
1618
itertools = "0.14.0"
1719
serde = { version = "1.0.217", features = ["derive"] }
1820
serde_json = "1.0.138"
21+
tempfile = "3.7.0"

crates/codspeed/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ name = "native"
2929
harness = false
3030

3131
[dev-dependencies]
32-
tempfile = "3.7.0"
32+
tempfile = { workspace = true }

crates/criterion_compat/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ categories = [
1717
]
1818
keywords = ["codspeed", "benchmark", "criterion"]
1919
[dependencies]
20-
criterion = { version = "0.5.1", default-features = false }
20+
criterion = { package = "codspeed-criterion-compat-walltime", path = "criterion-0.5.1", version = "0.5.1", default-features = false }
2121
codspeed = { path = "../codspeed", version = "=2.8.1" }
2222
colored = "2.1.0"
2323

crates/criterion_compat/criterion-0.5.1/Cargo.toml

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
[package]
1313
edition = "2018"
14-
name = "criterion"
14+
name = "codspeed-criterion-compat-walltime"
1515
version = "0.5.1"
1616
authors = [
1717
"Jorge Aparicio <[email protected]>",
@@ -21,29 +21,26 @@ exclude = ["book/*"]
2121
description = "Statistics-driven micro-benchmarking library"
2222
homepage = "https://bheisler.github.io/criterion.rs/book/index.html"
2323
readme = "README.md"
24-
keywords = [
25-
"criterion",
26-
"benchmark",
27-
]
24+
keywords = ["criterion", "benchmark"]
2825
categories = ["development-tools::profiling"]
2926
license = "Apache-2.0 OR MIT"
3027
repository = "https://github.com/bheisler/criterion.rs"
3128

3229
[package.metadata.docs.rs]
33-
features = [
34-
"async_futures",
35-
"async_smol",
36-
"async_std",
37-
"async_tokio",
38-
]
30+
features = ["async_futures", "async_smol", "async_std", "async_tokio"]
3931

4032
[lib]
4133
bench = false
34+
doctest = false
4235

4336
[[bench]]
4437
name = "bench_main"
4538
harness = false
4639

40+
[dependencies.codspeed]
41+
path = "../../codspeed"
42+
version = "=2.8.1"
43+
4744
[dependencies.anes]
4845
version = "0.1.4"
4946

@@ -72,7 +69,7 @@ optional = true
7269
[dependencies.futures]
7370
version = "0.3"
7471
optional = true
75-
default_features = false
72+
default-features = false
7673

7774
[dependencies.is-terminal]
7875
version = "0.4.6"
@@ -93,11 +90,7 @@ version = "11.1"
9390

9491
[dependencies.plotters]
9592
version = "^0.3.1"
96-
features = [
97-
"svg_backend",
98-
"area_series",
99-
"line_series",
100-
]
93+
features = ["svg_backend", "area_series", "line_series"]
10194
optional = true
10295
default-features = false
10396

@@ -142,7 +135,7 @@ version = "0.5.0"
142135
[dev-dependencies.futures]
143136
version = "0.3"
144137
features = ["executor"]
145-
default_features = false
138+
default-features = false
146139

147140
[dev-dependencies.quickcheck]
148141
version = "1.0"
@@ -152,33 +145,17 @@ default-features = false
152145
version = "0.8"
153146

154147
[dev-dependencies.tempfile]
155-
version = "~3.5.0"
148+
workspace = true
156149

157150
[features]
158151
async = ["futures"]
159-
async_futures = [
160-
"futures/executor",
161-
"async",
162-
]
163-
async_smol = [
164-
"smol",
165-
"async",
166-
]
167-
async_std = [
168-
"async-std",
169-
"async",
170-
]
171-
async_tokio = [
172-
"tokio",
173-
"async",
174-
]
152+
async_futures = ["futures/executor", "async"]
153+
async_smol = ["smol", "async"]
154+
async_std = ["async-std", "async"]
155+
async_tokio = ["tokio", "async"]
175156
cargo_bench_support = []
176157
csv_output = ["csv"]
177-
default = [
178-
"rayon",
179-
"plotters",
180-
"cargo_bench_support",
181-
]
158+
default = ["rayon", "plotters", "cargo_bench_support"]
182159
html_reports = []
183160
real_blackbox = []
184161
stable = [
@@ -192,3 +169,6 @@ stable = [
192169

193170
[badges.maintenance]
194171
status = "passively-maintained"
172+
173+
[lints.clippy]
174+
deprecated_clippy_cfg_attr = "allow"

crates/criterion_compat/criterion-0.5.1/benches/bench_main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![allow(clippy::all, dead_code)]
2+
extern crate codspeed_criterion_compat_walltime as criterion;
3+
14
use criterion::criterion_main;
25

36
mod benchmarks;

crates/criterion_compat/criterion-0.5.1/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
//! * Produces detailed charts, providing thorough understanding of your code's
1616
//! performance behavior.
1717
18+
#![allow(clippy::all, unexpected_cfgs, dead_code)]
1819
#![warn(missing_docs)]
1920
#![warn(bare_trait_objects)]
20-
#![cfg_attr(feature = "real_blackbox", feature(test))]
2121
#![cfg_attr(
2222
feature = "cargo-clippy",
2323
allow(
@@ -39,9 +39,6 @@ extern crate quickcheck;
3939
use is_terminal::IsTerminal;
4040
use regex::Regex;
4141

42-
#[cfg(feature = "real_blackbox")]
43-
extern crate test;
44-
4542
#[macro_use]
4643
extern crate serde_derive;
4744

@@ -155,7 +152,7 @@ fn debug_enabled() -> bool {
155152
/// This variant is backed by the (unstable) test::black_box function.
156153
#[cfg(feature = "real_blackbox")]
157154
pub fn black_box<T>(dummy: T) -> T {
158-
test::black_box(dummy)
155+
core::hint::black_box(dummy)
159156
}
160157

161158
/// A function that is opaque to the optimizer, used to prevent the compiler from

crates/criterion_compat/criterion-0.5.1/tests/criterion_tests.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![allow(clippy::all)]
2+
extern crate codspeed_criterion_compat_walltime as criterion;
3+
14
#[cfg(feature = "plotters")]
25
use criterion::SamplingMode;
36
use criterion::{

0 commit comments

Comments
 (0)