diff --git a/test/bench.hpp b/test/bench.hpp index 64c792f..e703194 100644 --- a/test/bench.hpp +++ b/test/bench.hpp @@ -19,10 +19,34 @@ void testBench(const G1& P, const G2& Q) CYBOZU_BENCH_C("G1::mul ", C, G1::mul, Pa, Pa, a); CYBOZU_BENCH_C("G1::add ", C, G1::add, Pa, Pa, P); CYBOZU_BENCH_C("G1::dbl ", C, G1::dbl, Pa, Pa); + { + G1 P1 = Pa, P2 = Pa + P, P3; + CYBOZU_BENCH_C("G1::add(1) ", C3, G1::add, P3, P1, P2); + P1.normalize(); + CYBOZU_BENCH_C("G1::add(2) ", C3, G1::add, P3, P1, P2); + P2.normalize(); + CYBOZU_BENCH_C("G1::add(3) ", C3, G1::add, P3, P1, P2); + P1 = P3; + CYBOZU_BENCH_C("G1::dbl(1) ", C3, G1::dbl, P3, P1); + P1.normalize(); + CYBOZU_BENCH_C("G1::dbl(2) ", C3, G1::dbl, P3, P1); + } CYBOZU_BENCH_C("G2::mulCT ", C, G2::mulCT, Qa, Q, a); CYBOZU_BENCH_C("G2::mul ", C, G2::mul, Qa, Qa, a); CYBOZU_BENCH_C("G2::add ", C, G2::add, Qa, Qa, Q); CYBOZU_BENCH_C("G2::dbl ", C, G2::dbl, Qa, Qa); + { + G2 Q1 = Qa, Q2 = Qa + Q, Q3; + CYBOZU_BENCH_C("G2::add(1) ", C3, G2::add, Q3, Q1, Q2); + Q1.normalize(); + CYBOZU_BENCH_C("G2::add(2) ", C3, G2::add, Q3, Q1, Q2); + Q2.normalize(); + CYBOZU_BENCH_C("G2::add(3) ", C3, G2::add, Q3, Q1, Q2); + Q1 = Q3; + CYBOZU_BENCH_C("G2::dbl(1) ", C3, G2::dbl, Q3, Q1); + Q1.normalize(); + CYBOZU_BENCH_C("G2::dbl(2) ", C3, G2::dbl, Q3, Q1); + } CYBOZU_BENCH_C("GT::pow ", C, GT::pow, e1, e1, a); // CYBOZU_BENCH_C("GT::powGLV ", C, BN::param.glv2.pow, e1, e1, a); G1 PP; @@ -85,6 +109,7 @@ void testBench(const G1& P, const G2& Q) CYBOZU_BENCH_C("finalExp ", 3000, finalExp, e1, e1); //exit(1); std::vector Qcoeff; + CYBOZU_BENCH_C("precomputeG2 ", C, precomputeG2, Qcoeff, Q); precomputeG2(Qcoeff, Q); CYBOZU_BENCH_C("precomputedML ", C, precomputedMillerLoop, e2, P, Qcoeff); }