diff --git a/Cargo.toml b/Cargo.toml index f6342d3..f9ee21d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,6 @@ tinytemplate = { version = "*", optional = true, path = "tmpls/tinytemplate", pa ahash = { version = "0.8.11", features = ["no-rng"] } criterion = { version = "0.5.1", features = ["html_reports"] } -quanta = "0.12.3" [[bench]] name = "template-benchmark" diff --git a/src/lib.rs b/src/lib.rs index 26e81bf..c2ce193 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,8 @@ use std::hint::black_box; -use std::time::Duration; +use std::time::{Duration, Instant}; use ahash::RandomState; use criterion::{Bencher, Criterion}; -use quanta::Instant; use tmpls::{Benchmark, BigTable, Output, Team, Teams}; macro_rules! for_each { @@ -91,20 +90,14 @@ fn run( func: impl Fn(&mut B, &mut B::Output, &I) -> Result<(), B::Error>, ) { let mut output = B::Output::default(); - for _ in 0..BATCH_SIZE { - func(this, &mut output, input).unwrap(); - } + func(this, &mut output, input).unwrap(); let expected_hash = collect_output(&mut output); b.iter_custom(|iters| { let mut total = 0; - for _ in 0..iters.div_ceil(BATCH_SIZE as u64) { + for _ in 0..iters { let start = Instant::now(); - for _ in 0..BATCH_SIZE { - let output = black_box(&mut output); - let input = black_box(input); - func(this, output, input).unwrap(); - } + black_box(func(this, black_box(&mut output), black_box(input))).unwrap(); total += start.elapsed().as_nanos() as u64; let hash = collect_output(&mut output); @@ -129,5 +122,3 @@ fn collect_output(output: &mut impl Output) -> u64 { output.clear(); hash } - -const BATCH_SIZE: usize = 100;