Skip to content

Commit e4bd2bc

Browse files
committed
chore(criterion_compat): fork criterion
1 parent 88ca9c2 commit e4bd2bc

File tree

16 files changed

+96
-101
lines changed

16 files changed

+96
-101
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: 3 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",

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: 14 additions & 38 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,21 +21,13 @@ 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
@@ -44,6 +36,10 @@ bench = false
4436
name = "bench_main"
4537
harness = false
4638

39+
[dependencies.codspeed]
40+
path = "../../codspeed"
41+
version = "=2.8.1"
42+
4743
[dependencies.anes]
4844
version = "0.1.4"
4945

@@ -93,11 +89,7 @@ version = "11.1"
9389

9490
[dependencies.plotters]
9591
version = "^0.3.1"
96-
features = [
97-
"svg_backend",
98-
"area_series",
99-
"line_series",
100-
]
92+
features = ["svg_backend", "area_series", "line_series"]
10193
optional = true
10294
default-features = false
10395

@@ -152,33 +144,17 @@ default-features = false
152144
version = "0.8"
153145

154146
[dev-dependencies.tempfile]
155-
version = "~3.5.0"
147+
version = "~3.7.0"
156148

157149
[features]
158150
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-
]
151+
async_futures = ["futures/executor", "async"]
152+
async_smol = ["smol", "async"]
153+
async_std = ["async-std", "async"]
154+
async_tokio = ["tokio", "async"]
175155
cargo_bench_support = []
176156
csv_output = ["csv"]
177-
default = [
178-
"rayon",
179-
"plotters",
180-
"cargo_bench_support",
181-
]
157+
default = ["rayon", "plotters", "cargo_bench_support"]
182158
html_reports = []
183159
real_blackbox = []
184160
stable = [

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/analysis/compare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::report::BenchmarkId;
1212
use crate::{fs, Criterion, SavedSample};
1313

1414
// Common comparison procedure
15-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::type_complexity))]
15+
#[allow(clippy::type_complexity)]
1616
pub(crate) fn common<M: Measurement>(
1717
id: &BenchmarkId,
1818
avg_times: &Sample<f64>,

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,9 @@
1515
//! * Produces detailed charts, providing thorough understanding of your code's
1616
//! performance behavior.
1717
18+
#![allow(clippy::all, dead_code)]
1819
#![warn(missing_docs)]
1920
#![warn(bare_trait_objects)]
20-
#![cfg_attr(feature = "real_blackbox", feature(test))]
21-
#![cfg_attr(
22-
feature = "cargo-clippy",
23-
allow(
24-
clippy::just_underscores_and_digits, // Used in the stats code
25-
clippy::transmute_ptr_to_ptr, // Used in the stats code
26-
clippy::manual_non_exhaustive, // Remove when MSRV bumped above 1.40
27-
)
28-
)]
2921

3022
#[cfg(all(feature = "rayon", target_arch = "wasm32"))]
3123
compile_error!("Rayon cannot be used when targeting wasi32. Try disabling default features.");
@@ -39,9 +31,6 @@ extern crate quickcheck;
3931
use is_terminal::IsTerminal;
4032
use regex::Regex;
4133

42-
#[cfg(feature = "real_blackbox")]
43-
extern crate test;
44-
4534
#[macro_use]
4635
extern crate serde_derive;
4736

@@ -155,7 +144,7 @@ fn debug_enabled() -> bool {
155144
/// This variant is backed by the (unstable) test::black_box function.
156145
#[cfg(feature = "real_blackbox")]
157146
pub fn black_box<T>(dummy: T) -> T {
158-
test::black_box(dummy)
147+
core::hint::black_box(dummy)
159148
}
160149

161150
/// A function that is opaque to the optimizer, used to prevent the compiler from
@@ -766,7 +755,7 @@ impl<M: Measurement> Criterion<M> {
766755
/// Configure this criterion struct based on the command-line arguments to
767756
/// this process.
768757
#[must_use]
769-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cognitive_complexity))]
758+
#[allow(clippy::cognitive_complexity)]
770759
pub fn configure_from_args(mut self) -> Criterion<M> {
771760
use clap::{value_parser, Arg, Command};
772761
let matches = Command::new("Criterion Benchmark")

crates/criterion_compat/criterion-0.5.1/src/plot/gnuplot_backend/summary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl AxisScale {
3232
}
3333
}
3434

35-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::explicit_counter_loop))]
35+
#[allow(clippy::explicit_counter_loop)]
3636
pub fn line_comparison(
3737
formatter: &dyn ValueFormatter,
3838
title: &str,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl CliReport {
400400
}
401401

402402
// Passing a String is the common case here.
403-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_pass_by_value))]
403+
#[allow(clippy::needless_pass_by_value)]
404404
fn print_overwritable(&self, s: String) {
405405
if self.enable_text_overwrite {
406406
eprint!("{}", s);

crates/criterion_compat/criterion-0.5.1/src/stats/bivariate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Data<'a, X, Y>(&'a [X], &'a [Y]);
2121

2222
impl<'a, X, Y> Copy for Data<'a, X, Y> {}
2323

24-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::expl_impl_clone_on_copy))]
24+
#[allow(clippy::expl_impl_clone_on_copy)]
2525
impl<'a, X, Y> Clone for Data<'a, X, Y> {
2626
fn clone(&self) -> Data<'a, X, Y> {
2727
*self

crates/criterion_compat/criterion-0.5.1/src/stats/bivariate/resamples.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ where
1212
stage: Option<(Vec<X>, Vec<Y>)>,
1313
}
1414

15-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))]
15+
#[allow(clippy::should_implement_trait)]
1616
impl<'a, X, Y> Resamples<'a, X, Y>
1717
where
1818
X: 'a + Float,

crates/criterion_compat/criterion-0.5.1/src/stats/univariate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub use self::sample::Sample;
2525
/// - Multithreaded
2626
/// - Time: `O(nresamples)`
2727
/// - Memory: `O(nresamples)`
28-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_lossless))]
28+
#[allow(clippy::cast_lossless)]
2929
pub fn bootstrap<A, B, T, S>(
3030
a: &Sample<A>,
3131
b: &Sample<B>,

crates/criterion_compat/criterion-0.5.1/src/stats/univariate/outliers/tukey.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ where
7070
/// Returns the number of data points per label
7171
///
7272
/// - Time: `O(length)`
73-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::similar_names))]
73+
#[allow(clippy::similar_names)]
7474
pub fn count(&self) -> (usize, usize, usize, usize, usize) {
7575
let (mut los, mut lom, mut noa, mut him, mut his) = (0, 0, 0, 0, 0);
7676

@@ -129,7 +129,7 @@ where
129129
{
130130
type Output = Label;
131131

132-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::similar_names))]
132+
#[allow(clippy::similar_names)]
133133
fn index(&self, i: usize) -> &Label {
134134
static LOW_SEVERE: Label = LowSevere;
135135
static LOW_MILD: Label = LowMild;
@@ -181,7 +181,7 @@ where
181181
{
182182
type Item = (A, Label);
183183

184-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::similar_names))]
184+
#[allow(clippy::similar_names)]
185185
fn next(&mut self) -> Option<(A, Label)> {
186186
self.iter.next().map(|&x| {
187187
let (lost, lomt, himt, hist) = self.fences;

0 commit comments

Comments
 (0)