Skip to content

Commit

Permalink
bench sum-of-products
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Whitehead <[email protected]>
  • Loading branch information
andrewwhitehead committed Aug 7, 2021
1 parent fb7a35c commit 0187cd0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions benches/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fn criterion_benchmark(c: &mut Criterion) {
b.iter(|| r.final_exponentiation())
});
}

// G1Affine
{
let name = "G1Affine";
Expand Down Expand Up @@ -67,6 +68,9 @@ fn criterion_benchmark(c: &mut Criterion) {
let v = vec![G1Projective::generator(); N];
let mut q = vec![G1Affine::identity(); N];

let sb = vec![G1Projective::generator(); N];
let ss = vec![Scalar::one(); N];

c.bench_function(&format!("{} check on curve", name), move |b| {
b.iter(|| black_box(a).is_on_curve())
});
Expand Down Expand Up @@ -94,6 +98,9 @@ fn criterion_benchmark(c: &mut Criterion) {
black_box(&q)[0]
})
});
c.bench_function(&format!("{} sum of products n={}", name, N), move |b| {
b.iter(|| G1Projective::sum_of_products(black_box(&sb), black_box(&ss)))
});
}

// G2Affine
Expand Down Expand Up @@ -136,6 +143,9 @@ fn criterion_benchmark(c: &mut Criterion) {
let v = vec![G2Projective::generator(); N];
let mut q = vec![G2Affine::identity(); N];

let sb = vec![G2Projective::generator(); N];
let ss = vec![Scalar::one(); N];

c.bench_function(&format!("{} check on curve", name), move |b| {
b.iter(|| black_box(a).is_on_curve())
});
Expand Down Expand Up @@ -163,6 +173,9 @@ fn criterion_benchmark(c: &mut Criterion) {
black_box(&q)[0]
})
});
c.bench_function(&format!("{} sum of products n={}", name, N), move |b| {
b.iter(|| G2Projective::sum_of_products(black_box(&sb), black_box(&ss)))
});
}
}

Expand Down

0 comments on commit 0187cd0

Please sign in to comment.