|
|
|
@ -1,10 +1,9 @@ |
|
|
|
|
template<class CT> |
|
|
|
|
void testBench(const G1& P, const G2& Q) |
|
|
|
|
{ |
|
|
|
|
G1 Pa; |
|
|
|
|
G2 Qa; |
|
|
|
|
Fp12 e1, e2; |
|
|
|
|
CT::pairing(e1, P, Q); |
|
|
|
|
pairing(e1, P, Q); |
|
|
|
|
Fp12::pow(e2, e1, 12345); |
|
|
|
|
const int C = 500; |
|
|
|
|
const int C2 = 1000; |
|
|
|
@ -26,22 +25,22 @@ void testBench(const G1& P, const G2& Q) |
|
|
|
|
CYBOZU_BENCH_C("G2::add ", C, G2::add, Qa, Qa, Q); |
|
|
|
|
CYBOZU_BENCH_C("G2::dbl ", C, G2::dbl, Qa, Qa); |
|
|
|
|
CYBOZU_BENCH_C("GT::pow ", C, GT::pow, e1, e1, a); |
|
|
|
|
// CYBOZU_BENCH_C("GT::powGLV ", C, CT::param.glv2.pow, e1, e1, a);
|
|
|
|
|
// CYBOZU_BENCH_C("GT::powGLV ", C, BN::param.glv2.pow, e1, e1, a);
|
|
|
|
|
G1 PP; |
|
|
|
|
G2 QQ; |
|
|
|
|
std::string s; |
|
|
|
|
s = P.getStr(); |
|
|
|
|
CYBOZU_BENCH_C("G1::setStr chk", C, PP.setStr, s); |
|
|
|
|
CT::verifyOrderG1(false); |
|
|
|
|
verifyOrderG1(false); |
|
|
|
|
CYBOZU_BENCH_C("G1::setStr ", C, PP.setStr, s); |
|
|
|
|
CT::verifyOrderG1(true); |
|
|
|
|
verifyOrderG1(true); |
|
|
|
|
s = Q.getStr(); |
|
|
|
|
CYBOZU_BENCH_C("G2::setStr chk", C, QQ.setStr, s); |
|
|
|
|
CT::verifyOrderG2(false); |
|
|
|
|
verifyOrderG2(false); |
|
|
|
|
CYBOZU_BENCH_C("G2::setStr ", C, QQ.setStr, s); |
|
|
|
|
CT::verifyOrderG2(true); |
|
|
|
|
CYBOZU_BENCH_C("hashAndMapToG1", C, CT::hashAndMapToG1, PP, "abc", 3); |
|
|
|
|
CYBOZU_BENCH_C("hashAndMapToG2", C, CT::hashAndMapToG2, QQ, "abc", 3); |
|
|
|
|
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); |
|
|
|
@ -51,10 +50,10 @@ void testBench(const G1& P, const G2& Q) |
|
|
|
|
CYBOZU_BENCH_C("GT::mul ", C2, GT::mul, e1, e1, e2); |
|
|
|
|
CYBOZU_BENCH_C("GT::sqr ", C2, GT::sqr, e1, e1); |
|
|
|
|
CYBOZU_BENCH_C("GT::inv ", C2, GT::inv, e1, e1); |
|
|
|
|
CYBOZU_BENCH_C("pairing ", C, CT::pairing, e1, P, Q); |
|
|
|
|
CYBOZU_BENCH_C("millerLoop ", C, CT::millerLoop, e1, P, Q); |
|
|
|
|
CYBOZU_BENCH_C("finalExp ", C, CT::finalExp, e1, e1); |
|
|
|
|
CYBOZU_BENCH_C("pairing ", C, pairing, e1, P, Q); |
|
|
|
|
CYBOZU_BENCH_C("millerLoop ", C, millerLoop, e1, P, Q); |
|
|
|
|
CYBOZU_BENCH_C("finalExp ", C, finalExp, e1, e1); |
|
|
|
|
std::vector<Fp6> Qcoeff; |
|
|
|
|
CT::precomputeG2(Qcoeff, Q); |
|
|
|
|
CYBOZU_BENCH_C("precomputedML ", C, CT::precomputedMillerLoop, e2, P, Qcoeff); |
|
|
|
|
precomputeG2(Qcoeff, Q); |
|
|
|
|
CYBOZU_BENCH_C("precomputedML ", C, precomputedMillerLoop, e2, P, Qcoeff); |
|
|
|
|
} |
|
|
|
|