Add verify equihash benchmark

This commit is contained in:
Taylor Hornby 2016-04-11 10:02:09 -06:00
parent d44feea44c
commit a1cd1a27ac
4 changed files with 30 additions and 3 deletions

View File

@ -70,6 +70,13 @@ zcashd_start
zcash_rpc zcbenchmark solveequihash 10 zcash_rpc zcbenchmark solveequihash 10
zcashd_stop zcashd_stop
echo ""
echo "Verify Equihash"
echo "------------------"
zcashd_start
zcash_rpc zcbenchmark verifyequihash 1000
zcashd_stop
echo "" echo ""
echo "" echo ""
echo "Memory" echo "Memory"
@ -109,3 +116,10 @@ echo "------------------"
zcashd_massif_start zcashd_massif_start
zcash_rpc zcbenchmark verifyjoinsplit 1 "$RAWTXWITHPOUR" zcash_rpc zcbenchmark verifyjoinsplit 1 "$RAWTXWITHPOUR"
zcashd_massif_stop zcashd_massif_stop
echo ""
echo "Verify Equihash"
echo "------------------"
zcashd_massif_start
zcash_rpc zcbenchmark verifyequihash 1
zcashd_massif_stop

View File

@ -2413,7 +2413,7 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp)
} else if (benchmarktype == "solveequihash") { } else if (benchmarktype == "solveequihash") {
sample_times.push_back(benchmark_solve_equihash()); sample_times.push_back(benchmark_solve_equihash());
} else if (benchmarktype == "verifyequihash") { } else if (benchmarktype == "verifyequihash") {
throw JSONRPCError(RPC_TYPE_ERROR, "Unimplemented"); sample_times.push_back(benchmark_verify_equihash());
} else { } else {
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid benchmarktype"); throw JSONRPCError(RPC_TYPE_ERROR, "Invalid benchmarktype");
} }

View File

@ -7,6 +7,7 @@
#include "primitives/transaction.h" #include "primitives/transaction.h"
#include "crypto/equihash.h" #include "crypto/equihash.h"
#include "chainparams.h" #include "chainparams.h"
#include "pow.h"
#include "zcbenchmarks.h" #include "zcbenchmarks.h"
@ -91,6 +92,13 @@ double benchmark_create_joinsplit()
return ret; return ret;
} }
double benchmark_verify_joinsplit(const CPourTx &joinsplit)
{
timer_start();
joinsplit.Verify(*pzerocashParams);
return timer_stop();
}
double benchmark_solve_equihash() double benchmark_solve_equihash()
{ {
const char *testing = "testing"; const char *testing = "testing";
@ -103,9 +111,13 @@ double benchmark_solve_equihash()
return timer_stop(); return timer_stop();
} }
double benchmark_verify_joinsplit(const CPourTx &joinsplit) double benchmark_verify_equihash()
{ {
CChainParams params = Params(CBaseChainParams::MAIN);
CBlock genesis = Params(CBaseChainParams::MAIN).GenesisBlock();
CBlockHeader genesis_header = genesis.GetBlockHeader();
timer_start(); timer_start();
joinsplit.Verify(*pzerocashParams); CheckEquihashSolution(&genesis_header, params);
return timer_stop(); return timer_stop();
} }

View File

@ -9,5 +9,6 @@ extern double benchmark_parameter_loading();
extern double benchmark_create_joinsplit(); extern double benchmark_create_joinsplit();
extern double benchmark_solve_equihash(); extern double benchmark_solve_equihash();
extern double benchmark_verify_joinsplit(const CPourTx &joinsplit); extern double benchmark_verify_joinsplit(const CPourTx &joinsplit);
extern double benchmark_verify_equihash();
#endif #endif