From 076cf347bad857c4b237dc9ebbe38ed144ec5af9 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 17 Aug 2021 00:14:00 +0000 Subject: [PATCH] Fix non-unique benchmark IDs for newer criterion versions. --- Cargo.toml | 2 +- benches/dalek_benchmarks.rs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b6ccc62..cd0a4f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ travis-ci = { repository = "dalek-cryptography/curve25519-dalek", branch = "mast [dev-dependencies] sha2 = { version = "0.9", default-features = false } bincode = "1" -criterion = "0.3.0" +criterion = { version = "0.3.0", features = ["html_reports"] } hex = "0.4.2" rand = "0.7" diff --git a/benches/dalek_benchmarks.rs b/benches/dalek_benchmarks.rs index 136d0e7..308545c 100644 --- a/benches/dalek_benchmarks.rs +++ b/benches/dalek_benchmarks.rs @@ -180,12 +180,12 @@ mod multiscalar_benches { dynamic_fraction: f64, ) { for multiscalar_size in &MULTISCALAR_SIZES { - c.bench_with_input( - BenchmarkId::new( - "Variable-time mixed-base multiscalar multiplication ({:.0}pct dyn)", - format!("({:.0}pct dyn)", 100.0 * dynamic_fraction), - ), - &multiscalar_size, + let bench_id = BenchmarkId::new( + "Variable-time mixed-base", + format!("(size: {:?}), ({:.0}pct dyn)", multiscalar_size, 100.0 * dynamic_fraction), + ); + + c.bench_with_input(bench_id, &multiscalar_size, move |b, &&total_size| { let dynamic_size = ((total_size as f64) * dynamic_fraction) as usize; let static_size = total_size - dynamic_size; @@ -221,16 +221,18 @@ mod multiscalar_benches { } fn multiscalar_multiplications(c: &mut Criterion) { - let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar muls"); + let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar multiplications"); consttime_multiscalar_mul(&mut group); vartime_multiscalar_mul(&mut group); vartime_precomputed_pure_static(&mut group); let dynamic_fracs = [0.0, 0.2, 0.5]; + for frac in dynamic_fracs.iter() { vartime_precomputed_helper(&mut group, *frac); } + group.finish(); }