diff --git a/Cargo.toml b/Cargo.toml index 3fcd6a4..95dc6ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ name = "bench_main" harness = false [lib] +name = "criterion" bench = false [dependencies] @@ -35,7 +36,9 @@ bpaf = { version = "0.9.12", default-features = false } walkdir = "2.5" tinytemplate = "1.2.1" cast = "0.3" -num-traits = { version = "0.2.19", default-features = false, features = ["std"] } +num-traits = { version = "0.2.19", default-features = false, features = [ + "std", +] } oorandom = "11.1.3" # Optional dependencies @@ -62,7 +65,9 @@ tempfile = "3.10.1" approx = "0.5.1" quickcheck = { version = "1.0.3", default-features = false } rand = "0.8.5" -futures = { version = "0.3.30", default-features = false, features = ["executor"] } +futures = { version = "0.3.30", default-features = false, features = [ + "executor", +] } itertools-num = "0.1.3" num-complex = "0.4.5" diff --git a/benches/bench_main.rs b/benches/bench_main.rs index 60eb6d2..a153b23 100644 --- a/benches/bench_main.rs +++ b/benches/bench_main.rs @@ -1,4 +1,4 @@ -use criterion2::criterion_main; +use criterion::criterion_main; mod benchmarks; diff --git a/benches/benchmarks/async_measurement_overhead.rs b/benches/benchmarks/async_measurement_overhead.rs index 123dbd2..9330ace 100644 --- a/benches/benchmarks/async_measurement_overhead.rs +++ b/benches/benchmarks/async_measurement_overhead.rs @@ -1,4 +1,4 @@ -use criterion2::{async_executor::FuturesExecutor, criterion_group, BatchSize, Criterion}; +use criterion::{async_executor::FuturesExecutor, criterion_group, BatchSize, Criterion}; fn some_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("async overhead"); diff --git a/benches/benchmarks/compare_functions.rs b/benches/benchmarks/compare_functions.rs index da275fd..d9af837 100644 --- a/benches/benchmarks/compare_functions.rs +++ b/benches/benchmarks/compare_functions.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, BenchmarkId, Criterion}; +use criterion::{criterion_group, BenchmarkId, Criterion}; fn fibonacci_slow(n: u64) -> u64 { match n { diff --git a/benches/benchmarks/custom_measurement.rs b/benches/benchmarks/custom_measurement.rs index 61b5050..c4e3199 100644 --- a/benches/benchmarks/custom_measurement.rs +++ b/benches/benchmarks/custom_measurement.rs @@ -1,4 +1,4 @@ -use criterion2::{ +use criterion::{ black_box, criterion_group, measurement::{Measurement, ValueFormatter}, Criterion, Throughput, diff --git a/benches/benchmarks/external_process.rs b/benches/benchmarks/external_process.rs index 7bdc314..b0d38be 100644 --- a/benches/benchmarks/external_process.rs +++ b/benches/benchmarks/external_process.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, Criterion}; +use criterion::{criterion_group, Criterion}; use std::{ io::{BufRead, BufReader, Write}, process::{Command, Stdio}, diff --git a/benches/benchmarks/iter_with_large_drop.rs b/benches/benchmarks/iter_with_large_drop.rs index 2a34ae8..ee01de0 100644 --- a/benches/benchmarks/iter_with_large_drop.rs +++ b/benches/benchmarks/iter_with_large_drop.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, Criterion, Throughput}; +use criterion::{criterion_group, Criterion, Throughput}; use std::time::Duration; const SIZE: usize = 1024 * 1024; diff --git a/benches/benchmarks/iter_with_large_setup.rs b/benches/benchmarks/iter_with_large_setup.rs index ceb2c39..9ff2b9d 100644 --- a/benches/benchmarks/iter_with_large_setup.rs +++ b/benches/benchmarks/iter_with_large_setup.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, BatchSize, Criterion, Throughput}; +use criterion::{criterion_group, BatchSize, Criterion, Throughput}; use std::time::Duration; const SIZE: usize = 1024 * 1024; diff --git a/benches/benchmarks/iter_with_setup.rs b/benches/benchmarks/iter_with_setup.rs index 5ad14c1..e65495c 100644 --- a/benches/benchmarks/iter_with_setup.rs +++ b/benches/benchmarks/iter_with_setup.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, Criterion}; +use criterion::{criterion_group, Criterion}; const SIZE: usize = 1024 * 1024; diff --git a/benches/benchmarks/measurement_overhead.rs b/benches/benchmarks/measurement_overhead.rs index 0af657d..c424efb 100644 --- a/benches/benchmarks/measurement_overhead.rs +++ b/benches/benchmarks/measurement_overhead.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, BatchSize, Criterion}; +use criterion::{criterion_group, BatchSize, Criterion}; fn some_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("overhead"); diff --git a/benches/benchmarks/mod.rs b/benches/benchmarks/mod.rs index 038a0b4..ef85910 100644 --- a/benches/benchmarks/mod.rs +++ b/benches/benchmarks/mod.rs @@ -14,7 +14,7 @@ pub mod async_measurement_overhead; #[cfg(not(feature = "async_futures"))] pub mod async_measurement_overhead { - use criterion2::{criterion_group, Criterion}; + use criterion::{criterion_group, Criterion}; fn some_benchmark(_c: &mut Criterion) {} criterion_group!(benches, some_benchmark); diff --git a/benches/benchmarks/sampling_mode.rs b/benches/benchmarks/sampling_mode.rs index 8ef69c8..0ffbf86 100644 --- a/benches/benchmarks/sampling_mode.rs +++ b/benches/benchmarks/sampling_mode.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, Criterion, SamplingMode}; +use criterion::{criterion_group, Criterion, SamplingMode}; use std::thread::sleep; use std::time::Duration; diff --git a/benches/benchmarks/special_characters.rs b/benches/benchmarks/special_characters.rs index d005370..6140f9a 100644 --- a/benches/benchmarks/special_characters.rs +++ b/benches/benchmarks/special_characters.rs @@ -1,4 +1,4 @@ -use criterion2::{criterion_group, Criterion}; +use criterion::{criterion_group, Criterion}; fn some_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("\"*group/\""); diff --git a/benches/benchmarks/with_inputs.rs b/benches/benchmarks/with_inputs.rs index a935dd2..b0b12a8 100644 --- a/benches/benchmarks/with_inputs.rs +++ b/benches/benchmarks/with_inputs.rs @@ -1,6 +1,6 @@ use std::iter; -use criterion2::{criterion_group, BenchmarkId, Criterion, Throughput}; +use criterion::{criterion_group, BenchmarkId, Criterion, Throughput}; fn from_elem(c: &mut Criterion) { static KB: usize = 1024; diff --git a/src/bencher.rs b/src/bencher.rs index d0ad571..debcdff 100644 --- a/src/bencher.rs +++ b/src/bencher.rs @@ -57,7 +57,7 @@ impl<'a, M: Measurement> Bencher<'a, M> { /// # Example /// /// ```rust - /// use criterion2::*; + /// use criterion::*; /// /// // The function to benchmark /// fn foo() { @@ -100,8 +100,8 @@ impl<'a, M: Measurement> Bencher<'a, M> { /// /// # Example /// ```rust - /// use criterion2::*; - /// use criterion2::black_box; + /// use criterion::*; + /// use criterion::black_box; /// use std::time::Instant; /// /// fn foo() { @@ -159,7 +159,7 @@ impl<'a, M: Measurement> Bencher<'a, M> { /// # Example /// /// ```rust - /// use criterion2::*; + /// use criterion::*; /// /// fn create_vector() -> Vec { /// # vec![] @@ -200,7 +200,7 @@ impl<'a, M: Measurement> Bencher<'a, M> { /// # Example /// /// ```rust - /// use criterion2::*; + /// use criterion::*; /// /// fn create_scrambled_data() -> Vec { /// # vec![] @@ -288,7 +288,7 @@ impl<'a, M: Measurement> Bencher<'a, M> { /// # Example /// /// ```rust - /// use criterion2::*; + /// use criterion::*; /// /// fn create_scrambled_data() -> Vec { /// # vec![] @@ -398,8 +398,8 @@ impl<'a, 'b, A: AsyncExecutor, M: Measurement> AsyncBencher<'a, 'b, A, M> { /// # Example /// /// ```rust - /// use criterion2::*; - /// use criterion2::async_executor::FuturesExecutor; + /// use criterion::*; + /// use criterion::async_executor::FuturesExecutor; /// /// // The function to benchmark /// async fn foo() { @@ -446,9 +446,9 @@ impl<'a, 'b, A: AsyncExecutor, M: Measurement> AsyncBencher<'a, 'b, A, M> { /// /// # Example /// ```rust - /// use criterion2::*; - /// use criterion2::black_box; - /// use criterion2::async_executor::FuturesExecutor; + /// use criterion::*; + /// use criterion::black_box; + /// use criterion::async_executor::FuturesExecutor; /// use std::time::Instant; /// /// async fn foo() { @@ -513,8 +513,8 @@ impl<'a, 'b, A: AsyncExecutor, M: Measurement> AsyncBencher<'a, 'b, A, M> { /// # Example /// /// ```rust - /// use criterion2::*; - /// use criterion2::async_executor::FuturesExecutor; + /// use criterion::*; + /// use criterion::async_executor::FuturesExecutor; /// /// async fn create_vector() -> Vec { /// # vec![] @@ -627,8 +627,8 @@ impl<'a, 'b, A: AsyncExecutor, M: Measurement> AsyncBencher<'a, 'b, A, M> { /// # Example /// /// ```rust - /// use criterion2::*; - /// use criterion2::async_executor::FuturesExecutor; + /// use criterion::*; + /// use criterion::async_executor::FuturesExecutor; /// /// fn create_scrambled_data() -> Vec { /// # vec![] @@ -723,8 +723,8 @@ impl<'a, 'b, A: AsyncExecutor, M: Measurement> AsyncBencher<'a, 'b, A, M> { /// # Example /// /// ```rust - /// use criterion2::*; - /// use criterion2::async_executor::FuturesExecutor; + /// use criterion::*; + /// use criterion::async_executor::FuturesExecutor; /// /// fn create_scrambled_data() -> Vec { /// # vec![] diff --git a/src/benchmark_group.rs b/src/benchmark_group.rs index 06c424b..6395f08 100644 --- a/src/benchmark_group.rs +++ b/src/benchmark_group.rs @@ -19,7 +19,7 @@ use crate::{Mode, PlotConfiguration, SamplingMode, Throughput}; /// # Examples: /// /// ```no_run -/// use self::criterion2::*; +/// use self::criterion::*; /// use std::time::Duration; /// /// fn bench_simple(c: &mut Criterion) { @@ -412,7 +412,7 @@ impl BenchmarkId { /// /// # Examples /// ``` - /// # use criterion2::{BenchmarkId, Criterion}; + /// # use criterion::{BenchmarkId, Criterion}; /// // A basic benchmark ID is typically constructed from a constant string and a simple /// // parameter /// let basic_id = BenchmarkId::new("my_id", 5); diff --git a/src/criterion.rs b/src/criterion.rs index 6d88e05..60f587c 100644 --- a/src/criterion.rs +++ b/src/criterion.rs @@ -547,7 +547,7 @@ impl Criterion { /// # Examples: /// /// ```rust - /// use self::criterion2::*; + /// use self::criterion::*; /// /// fn bench_simple(c: &mut Criterion) { /// let mut group = c.benchmark_group("My Group"); @@ -583,7 +583,7 @@ where /// # Example /// /// ```rust - /// use self::criterion2::*; + /// use self::criterion::*; /// /// fn bench(c: &mut Criterion) { /// // Setup (construct data, allocate memory, etc) @@ -612,7 +612,7 @@ where /// # Example /// /// ```rust - /// use self::criterion2::*; + /// use self::criterion::*; /// /// fn bench(c: &mut Criterion) { /// // Setup (construct data, allocate memory, etc) diff --git a/src/criterion_plot/mod.rs b/src/criterion_plot/mod.rs index a170ef6..001a819 100644 --- a/src/criterion_plot/mod.rs +++ b/src/criterion_plot/mod.rs @@ -16,9 +16,9 @@ //! # use std::fs; //! # use std::path::Path; //! use itertools_num::linspace; -//! use criterion2::criterion_plot::prelude::*; +//! use criterion::criterion_plot::prelude::*; //! -//! # if let Err(_) = criterion2::criterion_plot::version() { +//! # if let Err(_) = criterion::criterion_plot::version() { //! # return; //! # } //! let ref xs = linspace::(-10., 10., 51).collect::>(); @@ -81,7 +81,7 @@ //! //! use itertools_num::linspace; //! use rand::Rng; -//! use criterion2::criterion_plot::prelude::*; +//! use criterion::criterion_plot::prelude::*; //! //! fn sinc(mut x: f64) -> f64 { //! if x == 0. { @@ -92,7 +92,7 @@ //! } //! } //! -//! # if let Err(_) = criterion2::criterion_plot::version() { +//! # if let Err(_) = criterion::criterion_plot::version() { //! # return; //! # } //! let ref xs_ = linspace::(-4., 4., 101).collect::>(); @@ -157,10 +157,10 @@ //! ``` //! # use std::fs; //! # use std::path::Path; -//! use criterion2::criterion_plot::prelude::*; +//! use criterion::criterion_plot::prelude::*; //! use rand::Rng; //! -//! # if let Err(_) = criterion2::criterion_plot::version() { +//! # if let Err(_) = criterion::criterion_plot::version() { //! # return; //! # } //! let xs = 1..11; @@ -225,13 +225,13 @@ //! //! use itertools_num::linspace; //! use num_complex::Complex; -//! use criterion2::criterion_plot::prelude::*; +//! use criterion::criterion_plot::prelude::*; //! //! fn tf(x: f64) -> Complex { //! Complex::new(0., x) / Complex::new(10., x) / Complex::new(1., x / 10_000.) //! } //! -//! # if let Err(_) = criterion2::criterion_plot::version() { +//! # if let Err(_) = criterion::criterion_plot::version() { //! # return; //! # } //! let (start, end): (f64, f64) = (1.1, 90_000.); @@ -297,9 +297,9 @@ //! use std::iter; //! //! use itertools_num::linspace; -//! use criterion2::criterion_plot::prelude::*; +//! use criterion::criterion_plot::prelude::*; //! -//! # if let Err(_) = criterion2::criterion_plot::version() { +//! # if let Err(_) = criterion::criterion_plot::version() { //! # return; //! # } //! let (start, end) = (-5., 5.); diff --git a/src/lib.rs b/src/lib.rs index 2033926..f1fc43f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -433,7 +433,7 @@ pub enum AxisScale { /// or benchmark group. /// /// ```rust -/// use self::criterion2::{Bencher, Criterion, PlotConfiguration, AxisScale}; +/// use self::criterion::{Bencher, Criterion, PlotConfiguration, AxisScale}; /// /// let plot_config = PlotConfiguration::default() /// .summary_scale(AxisScale::Logarithmic); diff --git a/src/macros.rs b/src/macros.rs index cb4e677..0f34ba9 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -17,7 +17,7 @@ /// Complete form: /// /// ``` -/// # use criterion2::{Criterion, criterion_group}; +/// # use criterion::{Criterion, criterion_group}; /// # fn bench_method1(c: &mut Criterion) { /// # } /// # @@ -41,7 +41,7 @@ /// Compact Form: /// /// ``` -/// # use criterion2::{Criterion, criterion_group}; +/// # use criterion::{Criterion, criterion_group}; /// # fn bench_method1(c: &mut Criterion) { /// # } /// # @@ -96,7 +96,7 @@ macro_rules! criterion_group { /// Since we've disabled the default benchmark harness, we need to add our own: /// /// ```ignore -/// use criterion2::Criterion; +/// use criterion::Criterion; /// fn bench_method1(c: &mut Criterion) { /// } /// diff --git a/tests/criterion_tests.rs b/tests/criterion_tests.rs index 42b84e5..90ddd61 100644 --- a/tests/criterion_tests.rs +++ b/tests/criterion_tests.rs @@ -1,6 +1,6 @@ #[cfg(feature = "plotters")] -use criterion2::SamplingMode; -use criterion2::{ +use criterion::SamplingMode; +use criterion::{ criterion_group, criterion_main, profiler::Profiler, BatchSize, BenchmarkFilter, BenchmarkId, Criterion, };