17 std::vector<uint256> hashes{};
19 for (
auto &item : hashes) {
24 "d8d4dfd014a533bc3941b8663fa6e7f3a8707af124f713164d75b0c3179ecb08")};
25 for (
bool mutate : {
false,
true}) {
26 bench.
name(mutate ?
"MerkleRootWithMutation" :
"MerkleRoot")
30 std::vector<uint256> leaves;
31 leaves.reserve((hashes.size() + 1) &
33 for (
size_t s = 0; s < hashes.size(); s++) {
34 leaves.push_back(hashes[s]);
39 std::move(leaves), mutate ? &mutated :
nullptr)};
40 assert(root == expected_root);
uint256 rand256() noexcept
generate a random uint256.
Main entry point to nanobench's benchmarking facility.
ANKERL_NANOBENCH(NODISCARD) std Bench & batch(T b) noexcept
Sets the batch size.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
ANKERL_NANOBENCH(NODISCARD) std Bench & name(char const *benchmarkName)
Name of the benchmark, will be shown in the table row.
Bench & unit(char const *unit)
Sets the operation unit.
uint256 ComputeMerkleRoot(std::vector< uint256 > hashes, bool *mutated)
static void MerkleRoot(benchmark::Bench &bench)
uint256 uint256S(const char *str)
uint256 from const char *.
for(const CTxIn &txin :tx.vin)