Skip to content

Commit

Permalink
chore: lib name alias to criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed May 28, 2024
1 parent d2d7c29 commit e99936b
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 53 deletions.
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ name = "bench_main"
harness = false

[lib]
name = "criterion"
bench = false

[dependencies]
Expand All @@ -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
Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion benches/bench_main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion2::criterion_main;
use criterion::criterion_main;

mod benchmarks;

Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/async_measurement_overhead.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/compare_functions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion2::{criterion_group, BenchmarkId, Criterion};
use criterion::{criterion_group, BenchmarkId, Criterion};

fn fibonacci_slow(n: u64) -> u64 {
match n {
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/custom_measurement.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion2::{
use criterion::{
black_box, criterion_group,
measurement::{Measurement, ValueFormatter},
Criterion, Throughput,
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/external_process.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion2::{criterion_group, Criterion};
use criterion::{criterion_group, Criterion};
use std::{
io::{BufRead, BufReader, Write},
process::{Command, Stdio},
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/iter_with_large_drop.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/iter_with_large_setup.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/iter_with_setup.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion2::{criterion_group, Criterion};
use criterion::{criterion_group, Criterion};

const SIZE: usize = 1024 * 1024;

Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/measurement_overhead.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/sampling_mode.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion2::{criterion_group, Criterion, SamplingMode};
use criterion::{criterion_group, Criterion, SamplingMode};
use std::thread::sleep;
use std::time::Duration;

Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/special_characters.rs
Original file line number Diff line number Diff line change
@@ -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/\"");
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/with_inputs.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
34 changes: 17 additions & 17 deletions src/bencher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<'a, M: Measurement> Bencher<'a, M> {
/// # Example
///
/// ```rust
/// use criterion2::*;
/// use criterion::*;
///
/// // The function to benchmark
/// fn foo() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -159,7 +159,7 @@ impl<'a, M: Measurement> Bencher<'a, M> {
/// # Example
///
/// ```rust
/// use criterion2::*;
/// use criterion::*;
///
/// fn create_vector() -> Vec<u64> {
/// # vec![]
Expand Down Expand Up @@ -200,7 +200,7 @@ impl<'a, M: Measurement> Bencher<'a, M> {
/// # Example
///
/// ```rust
/// use criterion2::*;
/// use criterion::*;
///
/// fn create_scrambled_data() -> Vec<u64> {
/// # vec![]
Expand Down Expand Up @@ -288,7 +288,7 @@ impl<'a, M: Measurement> Bencher<'a, M> {
/// # Example
///
/// ```rust
/// use criterion2::*;
/// use criterion::*;
///
/// fn create_scrambled_data() -> Vec<u64> {
/// # vec![]
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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<u64> {
/// # vec![]
Expand Down Expand Up @@ -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<u64> {
/// # vec![]
Expand Down Expand Up @@ -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<u64> {
/// # vec![]
Expand Down
4 changes: 2 additions & 2 deletions src/benchmark_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/criterion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ impl<M: Measurement> Criterion<M> {
/// # Examples:
///
/// ```rust
/// use self::criterion2::*;
/// use self::criterion::*;
///
/// fn bench_simple(c: &mut Criterion) {
/// let mut group = c.benchmark_group("My Group");
Expand Down Expand Up @@ -583,7 +583,7 @@ where
/// # Example
///
/// ```rust
/// use self::criterion2::*;
/// use self::criterion::*;
///
/// fn bench(c: &mut Criterion) {
/// // Setup (construct data, allocate memory, etc)
Expand Down Expand Up @@ -612,7 +612,7 @@ where
/// # Example
///
/// ```rust
/// use self::criterion2::*;
/// use self::criterion::*;
///
/// fn bench(c: &mut Criterion) {
/// // Setup (construct data, allocate memory, etc)
Expand Down
20 changes: 10 additions & 10 deletions src/criterion_plot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<f64>(-10., 10., 51).collect::<Vec<_>>();
Expand Down Expand Up @@ -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. {
Expand All @@ -92,7 +92,7 @@
//! }
//! }
//!
//! # if let Err(_) = criterion2::criterion_plot::version() {
//! # if let Err(_) = criterion::criterion_plot::version() {
//! # return;
//! # }
//! let ref xs_ = linspace::<f64>(-4., 4., 101).collect::<Vec<_>>();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<f64> {
//! 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.);
Expand Down Expand Up @@ -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.);
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// Complete form:
///
/// ```
/// # use criterion2::{Criterion, criterion_group};
/// # use criterion::{Criterion, criterion_group};
/// # fn bench_method1(c: &mut Criterion) {
/// # }
/// #
Expand All @@ -41,7 +41,7 @@
/// Compact Form:
///
/// ```
/// # use criterion2::{Criterion, criterion_group};
/// # use criterion::{Criterion, criterion_group};
/// # fn bench_method1(c: &mut Criterion) {
/// # }
/// #
Expand Down Expand Up @@ -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) {
/// }
///
Expand Down
4 changes: 2 additions & 2 deletions tests/criterion_tests.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down

0 comments on commit e99936b

Please sign in to comment.