bench for setStr w/wo check

dev
MITSUNARI Shigeo 7 years ago
parent 8c8d616c9b
commit 4f0477170d
  1. 10
      include/mcl/bn.hpp
  2. 6
      src/bn_c_impl.hpp
  3. 6
      test/bench.hpp

@ -1817,6 +1817,16 @@ struct BNT {
{
hashAndMapToG2(P, str.c_str(), str.size());
}
static void verifyOrderG1(bool doVerify)
{
if (param.isBLS12) {
G1::setOrder(doVerify ? param.r : 0);
}
}
static void verifyOrderG2(bool doVerify)
{
G2::setOrder(doVerify ? param.r : 0);
}
};
template<class Fp>

@ -615,13 +615,11 @@ int mclBn_G2EvaluatePolynomial(mclBnG2 *out, const mclBnG2 *cVec, mclSize cSize,
void mclBn_verifyOrderG1(int doVerify)
{
if (BN::param.isBLS12) {
G1::setOrder(doVerify ? BN::param.r : 0);
}
BN::verifyOrderG1(doVerify != 0);
}
void mclBn_verifyOrderG2(int doVerify)
{
G2::setOrder(doVerify ? BN::param.r : 0);
BN::verifyOrderG2(doVerify != 0);
}

@ -31,9 +31,15 @@ void testBench(const G1& P, const G2& Q)
G2 QQ;
std::string s;
s = P.getStr();
CYBOZU_BENCH_C("G1::setStr chk", C, PP.setStr, s);
CT::verifyOrderG1(false);
CYBOZU_BENCH_C("G1::setStr ", C, PP.setStr, s);
CT::verifyOrderG1(true);
s = Q.getStr();
CYBOZU_BENCH_C("G2::setStr chk", C, QQ.setStr, s);
CT::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);
CYBOZU_BENCH_C("Fp::add ", C2, Fp::add, x, x, y);

Loading…
Cancel
Save