mirror of
https://github.com/saymrwulf/betrusted-curve25519-dalek-source.git
synced 2026-09-12 21:40:32 +00:00
Add a separate benchmark for pure-fixed multiscalar mul.
This commit is contained in:
parent
092ff52cb0
commit
2c3629b30e
1 changed files with 37 additions and 17 deletions
|
|
@ -110,9 +110,28 @@ mod multiscalar_benches {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn precomputed_vt_straus_helper(c: &mut Criterion, dynamic_fraction: f64) {
|
fn vartime_precomputed_pure_static(c: &mut Criterion) {
|
||||||
|
c.bench_function_over_inputs(
|
||||||
|
"Variable-time fixed-base multiscalar multiplication",
|
||||||
|
move |b, &&total_size| {
|
||||||
|
let static_size = total_size;
|
||||||
|
|
||||||
|
let (static_scalars, static_points) = construct(static_size);
|
||||||
|
|
||||||
|
use curve25519_dalek::edwards::VartimeEdwardsPrecomputation;
|
||||||
|
use curve25519_dalek::traits::VartimePrecomputedMultiscalarMul;
|
||||||
|
|
||||||
|
let precomp = VartimeEdwardsPrecomputation::new(&static_points);
|
||||||
|
|
||||||
|
b.iter(|| precomp.vartime_multiscalar_mul(&static_scalars));
|
||||||
|
},
|
||||||
|
&MULTISCALAR_SIZES,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn vartime_precomputed_helper(c: &mut Criterion, dynamic_fraction: f64) {
|
||||||
let label = format!(
|
let label = format!(
|
||||||
"Variable-time mixed-base Straus ({:.2}pct dyn)",
|
"Variable-time mixed-base multiscalar multiplication ({:.0}pct dyn)",
|
||||||
100.0 * dynamic_fraction,
|
100.0 * dynamic_fraction,
|
||||||
);
|
);
|
||||||
c.bench_function_over_inputs(
|
c.bench_function_over_inputs(
|
||||||
|
|
@ -141,16 +160,16 @@ mod multiscalar_benches {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn precomputed_vt_straus_00_pct_dynamic(c: &mut Criterion) {
|
fn vartime_precomputed_00_pct_dynamic(c: &mut Criterion) {
|
||||||
precomputed_vt_straus_helper(c, 0.0);
|
vartime_precomputed_helper(c, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn precomputed_vt_straus_20_pct_dynamic(c: &mut Criterion) {
|
fn vartime_precomputed_20_pct_dynamic(c: &mut Criterion) {
|
||||||
precomputed_vt_straus_helper(c, 0.2);
|
vartime_precomputed_helper(c, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn precomputed_vt_straus_50_pct_dynamic(c: &mut Criterion) {
|
fn vartime_precomputed_50_pct_dynamic(c: &mut Criterion) {
|
||||||
precomputed_vt_straus_helper(c, 0.5);
|
vartime_precomputed_helper(c, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
criterion_group! {
|
criterion_group! {
|
||||||
|
|
@ -160,9 +179,10 @@ mod multiscalar_benches {
|
||||||
targets =
|
targets =
|
||||||
consttime_multiscalar_mul,
|
consttime_multiscalar_mul,
|
||||||
vartime_multiscalar_mul,
|
vartime_multiscalar_mul,
|
||||||
precomputed_vt_straus_00_pct_dynamic,
|
vartime_precomputed_pure_static,
|
||||||
precomputed_vt_straus_20_pct_dynamic,
|
vartime_precomputed_00_pct_dynamic,
|
||||||
precomputed_vt_straus_50_pct_dynamic,
|
vartime_precomputed_20_pct_dynamic,
|
||||||
|
vartime_precomputed_50_pct_dynamic,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue