MCPcopy Create free account
hub / github.com/ElementsProject/elements / MerkleRoot

Function MerkleRoot

src/bench/merkle_root.cpp:11–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <uint256.h>
10
11static void MerkleRoot(benchmark::Bench& bench)
12{
13 FastRandomContext rng(true);
14 std::vector<uint256> leaves;
15 leaves.resize(9001);
16 for (auto& item : leaves) {
17 item = rng.rand256();
18 }
19 bench.batch(leaves.size()).unit("leaf").run([&] {
20 bool mutation = false;
21 uint256 hash = ComputeMerkleRoot(std::vector<uint256>(leaves), &mutation);
22 leaves[mutation] = hash;
23 });
24}
25
26BENCHMARK(MerkleRoot);

Callers

nothing calls this directly

Calls 6

ComputeMerkleRootFunction · 0.85
rand256Method · 0.80
resizeMethod · 0.45
runMethod · 0.45
batchMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected