add bench of FpDbl

dev
MITSUNARI Shigeo 7 years ago
parent fbfad9f4f8
commit fe1063ee3e
  1. 28
      test/bench.hpp

@ -7,6 +7,7 @@ void testBench(const G1& P, const G2& Q)
Fp12::pow(e2, e1, 12345);
const int C = 500;
const int C2 = 1000;
const int C3 = 10000;
Fp x, y;
x.setHashOf("abc");
y.setHashOf("xyz");
@ -41,10 +42,29 @@ void testBench(const G1& P, const G2& Q)
verifyOrderG2(true);
CYBOZU_BENCH_C("hashAndMapToG1", C, hashAndMapToG1, PP, "abc", 3);
CYBOZU_BENCH_C("hashAndMapToG2", C, hashAndMapToG2, QQ, "abc", 3);
CYBOZU_BENCH_C("Fp::add ", C2, Fp::add, x, x, y);
CYBOZU_BENCH_C("Fp::mul ", C2, Fp::mul, x, x, y);
CYBOZU_BENCH_C("Fp::sqr ", C2, Fp::sqr, x, x);
CYBOZU_BENCH_C("Fp::inv ", C2, Fp::inv, x, x);
CYBOZU_BENCH_C("Fp::add ", C3, Fp::add, x, x, y);
CYBOZU_BENCH_C("Fp::mul ", C3, Fp::mul, x, x, y);
CYBOZU_BENCH_C("Fp::sqr ", C3, Fp::sqr, x, x);
CYBOZU_BENCH_C("Fp::inv ", C3, Fp::inv, x, x);
Fp2 xx, yy;
xx.a = x;
xx.b = 3;
yy.a = y;
yy.b = -5;
CYBOZU_BENCH_C("Fp2::add ", C3, Fp2::add, xx, xx, yy);
CYBOZU_BENCH_C("Fp2::mul ", C3, Fp2::mul, xx, xx, yy);
CYBOZU_BENCH_C("Fp2::sqr ", C3, Fp2::sqr, xx, xx);
CYBOZU_BENCH_C("Fp2::inv ", C3, Fp2::inv, xx, xx);
FpDbl d0, d1;
x = 9;
y = 3;
CYBOZU_BENCH_C("FpDbl::mulPre ", C3, FpDbl::mulPre, d0, x, y);
CYBOZU_BENCH_C("FpDbl::sqrPre ", C3, FpDbl::sqrPre, d1, x);
CYBOZU_BENCH_C("FpDbl::add ", C3, FpDbl::add, d1, d1, d0);
CYBOZU_BENCH_C("FpDbl::sub ", C3, FpDbl::sub, d1, d1, d0);
CYBOZU_BENCH_C("FpDbl::addPre ", C3, FpDbl::addPre, d1, d1, d0);
CYBOZU_BENCH_C("FpDbl::subPre ", C3, FpDbl::subPre, d1, d1, d0);
CYBOZU_BENCH_C("FpDbl::mod ", C3, FpDbl::mod, x, d0);
CYBOZU_BENCH_C("GT::add ", C2, GT::add, e1, e1, e2);
CYBOZU_BENCH_C("GT::mul ", C2, GT::mul, e1, e1, e2);

Loading…
Cancel
Save