From 059e03ca9d91e9a0b7db672eecc1c3d8f0fbbafb Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Fri, 22 Nov 2019 13:09:56 -0700 Subject: [PATCH] Add benchmarks for some pairing subroutines. --- benches/groups.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/benches/groups.rs b/benches/groups.rs index 5d2b22b37..87c80d029 100644 --- a/benches/groups.rs +++ b/benches/groups.rs @@ -14,6 +14,18 @@ fn criterion_benchmark(c: &mut Criterion) { c.bench_function("full pairing", move |b| { b.iter(|| pairing(black_box(&g), black_box(&h))) }); + c.bench_function("G2 preparation for pairing", move |b| { + b.iter(|| G2Prepared::from(h)) + }); + let prep = G2Prepared::from(h); + c.bench_function("miller loop for pairing", move |b| { + b.iter(|| multi_miller_loop(&[(&g, &prep)])) + }); + let prep = G2Prepared::from(h); + let r = multi_miller_loop(&[(&g, &prep)]); + c.bench_function("final exponentiation for pairing", move |b| { + b.iter(|| r.final_exponentiation()) + }); } // G1Affine {