Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dalek_benchmarks argument handling #567

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions curve25519-dalek/benches/dalek_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
use rand::{rngs::OsRng, thread_rng};

use criterion::{
criterion_main, measurement::Measurement, BatchSize, BenchmarkGroup, BenchmarkId, Criterion,
criterion_group, criterion_main, measurement::Measurement, BatchSize, BenchmarkGroup,
BenchmarkId, Criterion,
};

use curve25519_dalek::constants;
Expand Down Expand Up @@ -56,8 +57,7 @@ mod edwards_benches {
});
}

pub(crate) fn edwards_benches() {
let mut c = Criterion::default();
pub(crate) fn edwards_benches(c: &mut Criterion) {
let mut g = c.benchmark_group("edwards benches");

compress(&mut g);
Expand Down Expand Up @@ -209,8 +209,7 @@ mod multiscalar_benches {
}
}

pub(crate) fn multiscalar_benches() {
let mut c = Criterion::default();
pub(crate) fn multiscalar_benches(c: &mut Criterion) {
let mut g = c.benchmark_group("multiscalar benches");

consttime_multiscalar_mul(&mut g);
Expand Down Expand Up @@ -259,8 +258,7 @@ mod ristretto_benches {
}
}

pub(crate) fn ristretto_benches() {
let mut c = Criterion::default();
pub(crate) fn ristretto_benches(c: &mut Criterion) {
let mut g = c.benchmark_group("ristretto benches");

compress(&mut g);
Expand Down Expand Up @@ -288,8 +286,7 @@ mod montgomery_benches {
});
}

pub(crate) fn montgomery_benches() {
let mut c = Criterion::default();
pub(crate) fn montgomery_benches(c: &mut Criterion) {
let mut g = c.benchmark_group("montgomery benches");

montgomery_ladder(&mut g);
Expand Down Expand Up @@ -348,19 +345,27 @@ mod scalar_benches {
}
}

pub(crate) fn scalar_benches() {
let mut c = Criterion::default();
pub(crate) fn scalar_benches(c: &mut Criterion) {
let mut g = c.benchmark_group("scalar benches");

scalar_arith(&mut g);
batch_scalar_inversion(&mut g);
}
}

criterion_group!(scalar_benches, scalar_benches::scalar_benches);
criterion_group!(montgomery_benches, montgomery_benches::montgomery_benches);
criterion_group!(ristretto_benches, ristretto_benches::ristretto_benches);
criterion_group!(edwards_benches, edwards_benches::edwards_benches);
criterion_group!(
multiscalar_benches,
multiscalar_benches::multiscalar_benches
);

criterion_main!(
scalar_benches::scalar_benches,
montgomery_benches::montgomery_benches,
ristretto_benches::ristretto_benches,
edwards_benches::edwards_benches,
multiscalar_benches::multiscalar_benches,
scalar_benches,
montgomery_benches,
ristretto_benches,
edwards_benches,
multiscalar_benches,
);