Skip to content

Commit bea620c

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

File tree

10 files changed

+97
-52
lines changed

10 files changed

+97
-52
lines changed

Cargo.lock

Lines changed: 69 additions & 37 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_fork",
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_fork", 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_fork/Cargo.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ authors = [
33
"Jorge Aparicio <[email protected]>",
44
"Brook Heisler <[email protected]>",
55
]
6-
name = "criterion"
6+
name = "codspeed-criterion-compat-walltime"
77
version = "0.5.1"
88
edition = "2018"
99

@@ -17,6 +17,7 @@ license = "Apache-2.0 OR MIT"
1717
exclude = ["book/*"]
1818

1919
[dependencies]
20+
codspeed = { path = "../../codspeed", version = "=2.8.1" }
2021
anes = "0.1.4"
2122
once_cell = "1.14"
2223
criterion-plot = { path = "plot", version = "0.5.0" }
@@ -37,7 +38,7 @@ regex = { version = "1.5", default-features = false, features = ["std"]
3738
# Optional dependencies
3839
rayon = { version = "1.3", optional = true }
3940
csv = { version = "1.1", optional = true }
40-
futures = { version = "0.3", default_features = false, optional = true }
41+
futures = { version = "0.3", default-features = false, optional = true }
4142
smol = { version = "1.2", default-features = false, optional = true }
4243
tokio = { version = "1.0", default-features = false, features = [
4344
"rt",
@@ -51,11 +52,11 @@ default-features = false
5152
features = ["svg_backend", "area_series", "line_series"]
5253

5354
[dev-dependencies]
54-
tempfile = "~3.5.0"
55+
tempfile = { workspace = true }
5556
approx = "0.5.0"
5657
quickcheck = { version = "1.0", default-features = false }
5758
rand = "0.8"
58-
futures = { version = "0.3", default_features = false, features = ["executor"] }
59+
futures = { version = "0.3", default-features = false, features = ["executor"] }
5960

6061
[badges]
6162
maintenance = { status = "passively-maintained" }
@@ -97,16 +98,17 @@ cargo_bench_support = []
9798
# cargo-criterion's --message-format=json option.
9899
csv_output = ["csv"]
99100

100-
[workspace]
101-
exclude = ["cargo-criterion"]
102-
103101
[[bench]]
104102
name = "bench_main"
105103
harness = false
106104

107105
[lib]
108106
bench = false
107+
doctest = false
109108

110109
# Enable all of the async runtimes for the docs.rs output
111110
[package.metadata.docs.rs]
112111
features = ["async_futures", "async_smol", "async_std", "async_tokio"]
112+
113+
[lints.clippy]
114+
deprecated_clippy_cfg_attr = "allow"

crates/criterion_compat/criterion_fork/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_fork/plot/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ rand = "0.8"
2424
travis-ci = { repository = "bheisler/criterion.rs" }
2525
appveyor = { repository = "bheisler/criterion.rs", id = "4255ads9ctpupcl2" }
2626
maintenance = { status = "looking-for-maintainer" }
27+
28+
[lints.clippy]
29+
deprecated_clippy_cfg_attr = "allow"

crates/criterion_compat/criterion_fork/plot/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::all, unexpected_cfgs)]
2+
13
//! [Criterion]'s plotting library.
24
//!
35
//! [Criterion]: https://github.com/bheisler/criterion.rs

crates/criterion_compat/criterion_fork/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_fork/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)