Browse Source

Add MSM benchmark (#24)

fq2_neg_nonresidue
Pratyush Mishra 3 years ago
committed by GitHub
parent
commit
e7d7d01a02
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions
  1. +1
    -0
      curve-benches/Cargo.toml
  2. +17
    -0
      curve-benches/src/macros/ec.rs

+ 1
- 0
curve-benches/Cargo.toml

@ -47,6 +47,7 @@ rand_xorshift = { version = "0.2" }
[features]
asm = [ "ark-ff/asm"]
parallel = [ "ark-ff/parallel", "ark-ec/parallel", ]
n_fold = []
[build-dependencies]

+ 17
- 0
curve-benches/src/macros/ec.rs

@ -178,6 +178,22 @@ macro_rules! ec_bench {
});
}
fn msm_131072(b: &mut $crate::bencher::Bencher) {
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
const SAMPLES: usize = 131072;
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
let g = <$projective>::rand(&mut rng).into_affine();
let v: Vec<_> = (0..SAMPLES).map(|_| g).collect();
let scalars: Vec<_> = (0..SAMPLES)
.map(|_| Fr::rand(&mut rng).into_repr())
.collect();
b.bench_n(1, |b| {
b.iter(|| ark_ec::msm::VariableBaseMSM::multi_scalar_mul(&v, &scalars));
})
}
$crate::benchmark_group!(
group_ops,
rand,
@ -188,6 +204,7 @@ macro_rules! ec_bench {
deser,
ser_unchecked,
deser_unchecked,
msm_131072,
);
};
}

Loading…
Cancel
Save