13#include <benchmark/benchmark.h>
18using namespace benchmark;
30template <
typename TreeType>
void perform_batch_insert(
TreeType& tree,
const std::vector<fr>& values)
35 tree.add_values(values, completion);
36 signal.wait_for_level(0);
42 auto completion = [&]() ->
void { signal.signal_level(0); };
43 tree.commit(completion);
44 signal.wait_for_level(0);
47template <
typename TreeType>
void append_only_tree_bench(State& state)
noexcept
49 const size_t batch_size = size_t(state.range(0));
54 std::filesystem::create_directories(directory);
55 uint32_t num_threads = 16;
62 for (
auto _ : state) {
64 std::vector<fr> values(batch_size);
65 for (
size_t i = 0; i < batch_size; ++i) {
69 perform_batch_insert(tree, values);
72 std::filesystem::remove_all(directory);
74BENCHMARK(append_only_tree_bench<Poseidon2>)
75 ->Unit(benchmark::kMillisecond)
79BENCHMARK(append_only_tree_bench<Poseidon2>)
80 ->Unit(benchmark::kMillisecond)
Implements a simple append-only merkle tree All methods are asynchronous unless specified as otherwis...
Serves as a key-value node store for merkle trees. Caches all changes in memory before persisting the...
Implements a parallelized batch insertion indexed tree Accepts template argument of the type of store...
std::shared_ptr< LMDBTreeStore > SharedPtr
Used in parallel insertions in the the IndexedTree. Workers signal to other following workes as they ...
void commit_tree(TreeType &tree, bool expected_success=true)
const size_t MAX_BATCH_SIZE
MerkleTree< MemoryStore, PedersenHashPolicy > TreeType
std::string random_temp_directory()
std::string random_string()
field< Bn254FrParams > fr
BENCHMARK(vector_of_evaluations) -> DenseRange(15, 21) ->Unit(kMillisecond) ->Iterations(1)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept