-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into as/standard_circuit_builder_fix
- Loading branch information
Showing
99 changed files
with
2,957 additions
and
933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
barretenberg/cpp/src/barretenberg/benchmark/append_only_tree_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
barretenberg_module(append_only_tree_bench crypto_poseidon2 crypto_merkle_tree) |
54 changes: 54 additions & 0 deletions
54
...etenberg/cpp/src/barretenberg/benchmark/append_only_tree_bench/append_only_tree.bench.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include "barretenberg/crypto/merkle_tree/append_only_tree/append_only_tree.hpp" | ||
#include "barretenberg/crypto/merkle_tree/array_store.hpp" | ||
#include "barretenberg/crypto/merkle_tree/hash.hpp" | ||
#include "barretenberg/numeric/random/engine.hpp" | ||
#include <benchmark/benchmark.h> | ||
|
||
using namespace benchmark; | ||
using namespace bb::crypto::merkle_tree; | ||
|
||
using Pedersen = AppendOnlyTree<ArrayStore, PedersenHashPolicy>; | ||
using Poseidon2 = AppendOnlyTree<ArrayStore, Poseidon2HashPolicy>; | ||
|
||
const size_t TREE_DEPTH = 32; | ||
const size_t MAX_BATCH_SIZE = 128; | ||
|
||
namespace { | ||
auto& random_engine = bb::numeric::get_randomness(); | ||
} // namespace | ||
|
||
template <typename TreeType> void perform_batch_insert(TreeType& tree, const std::vector<fr>& values) | ||
{ | ||
tree.add_values(values); | ||
} | ||
|
||
template <typename TreeType> void append_only_tree_bench(State& state) noexcept | ||
{ | ||
const size_t batch_size = size_t(state.range(0)); | ||
const size_t depth = TREE_DEPTH; | ||
|
||
ArrayStore store(depth, 1024 * 1024); | ||
TreeType tree = TreeType(store, depth); | ||
|
||
for (auto _ : state) { | ||
state.PauseTiming(); | ||
std::vector<fr> values(batch_size); | ||
for (size_t i = 0; i < batch_size; ++i) { | ||
values[i] = fr(random_engine.get_random_uint256()); | ||
} | ||
state.ResumeTiming(); | ||
perform_batch_insert(tree, values); | ||
} | ||
} | ||
BENCHMARK(append_only_tree_bench<Pedersen>) | ||
->Unit(benchmark::kMillisecond) | ||
->RangeMultiplier(2) | ||
->Range(2, MAX_BATCH_SIZE) | ||
->Iterations(100); | ||
BENCHMARK(append_only_tree_bench<Poseidon2>) | ||
->Unit(benchmark::kMillisecond) | ||
->RangeMultiplier(2) | ||
->Range(2, MAX_BATCH_SIZE) | ||
->Iterations(1000); | ||
|
||
BENCHMARK_MAIN(); |
2 changes: 1 addition & 1 deletion
2
barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
barretenberg_module(goblin_bench ultra_honk eccvm stdlib_recursion stdlib_sha256 stdlib_merkle_tree stdlib_primitives) | ||
barretenberg_module(goblin_bench ultra_honk eccvm stdlib_recursion stdlib_sha256 crypto_merkle_tree stdlib_primitives) |
1 change: 1 addition & 0 deletions
1
barretenberg/cpp/src/barretenberg/benchmark/indexed_tree_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
barretenberg_module(indexed_tree_bench crypto_poseidon2 crypto_merkle_tree) |
87 changes: 87 additions & 0 deletions
87
barretenberg/cpp/src/barretenberg/benchmark/indexed_tree_bench/indexed_tree.bench.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_tree.hpp" | ||
#include "barretenberg/crypto/merkle_tree/array_store.hpp" | ||
#include "barretenberg/crypto/merkle_tree/hash.hpp" | ||
#include "barretenberg/crypto/merkle_tree/indexed_tree/leaves_cache.hpp" | ||
#include "barretenberg/numeric/random/engine.hpp" | ||
#include <benchmark/benchmark.h> | ||
|
||
using namespace benchmark; | ||
using namespace bb::crypto::merkle_tree; | ||
|
||
using Poseidon2 = IndexedTree<ArrayStore, LeavesCache, Poseidon2HashPolicy>; | ||
using Pedersen = IndexedTree<ArrayStore, LeavesCache, PedersenHashPolicy>; | ||
|
||
const size_t TREE_DEPTH = 32; | ||
const size_t MAX_BATCH_SIZE = 128; | ||
|
||
namespace { | ||
auto& random_engine = bb::numeric::get_randomness(); | ||
} // namespace | ||
|
||
template <typename TreeType> | ||
void perform_batch_insert(TreeType& tree, const std::vector<fr>& values, bool single_threaded) | ||
{ | ||
tree.add_or_update_values(values, single_threaded); | ||
} | ||
|
||
template <typename TreeType> void multi_thread_indexed_tree_bench(State& state) noexcept | ||
{ | ||
const size_t batch_size = size_t(state.range(0)); | ||
const size_t depth = TREE_DEPTH; | ||
|
||
ArrayStore store(depth, 1024 * 1024); | ||
TreeType tree = TreeType(store, depth, batch_size); | ||
|
||
for (auto _ : state) { | ||
state.PauseTiming(); | ||
std::vector<fr> values(batch_size); | ||
for (size_t i = 0; i < batch_size; ++i) { | ||
values[i] = fr(random_engine.get_random_uint256()); | ||
} | ||
state.ResumeTiming(); | ||
perform_batch_insert(tree, values, false); | ||
} | ||
} | ||
|
||
template <typename TreeType> void single_thread_indexed_tree_bench(State& state) noexcept | ||
{ | ||
const size_t batch_size = size_t(state.range(0)); | ||
const size_t depth = TREE_DEPTH; | ||
|
||
ArrayStore store(depth, 1024 * 1024); | ||
TreeType tree = TreeType(store, depth, batch_size); | ||
|
||
for (auto _ : state) { | ||
state.PauseTiming(); | ||
std::vector<fr> values(batch_size); | ||
for (size_t i = 0; i < batch_size; ++i) { | ||
values[i] = fr(random_engine.get_random_uint256()); | ||
} | ||
state.ResumeTiming(); | ||
perform_batch_insert(tree, values, true); | ||
} | ||
} | ||
BENCHMARK(single_thread_indexed_tree_bench<Pedersen>) | ||
->Unit(benchmark::kMillisecond) | ||
->RangeMultiplier(2) | ||
->Range(2, MAX_BATCH_SIZE) | ||
->Iterations(100); | ||
|
||
BENCHMARK(multi_thread_indexed_tree_bench<Pedersen>) | ||
->Unit(benchmark::kMillisecond) | ||
->RangeMultiplier(2) | ||
->Range(2, MAX_BATCH_SIZE) | ||
->Iterations(100); | ||
|
||
BENCHMARK(single_thread_indexed_tree_bench<Poseidon2>) | ||
->Unit(benchmark::kMillisecond) | ||
->RangeMultiplier(2) | ||
->Range(2, MAX_BATCH_SIZE) | ||
->Iterations(1000); | ||
BENCHMARK(multi_thread_indexed_tree_bench<Poseidon2>) | ||
->Unit(benchmark::kMillisecond) | ||
->RangeMultiplier(2) | ||
->Range(2, MAX_BATCH_SIZE) | ||
->Iterations(1000); | ||
|
||
BENCHMARK_MAIN(); |
2 changes: 1 addition & 1 deletion
2
barretenberg/cpp/src/barretenberg/benchmark/ivc_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
barretenberg_module(ivc_bench client_ivc stdlib_recursion stdlib_sha256 stdlib_merkle_tree stdlib_primitives) | ||
barretenberg_module(ivc_bench client_ivc stdlib_recursion stdlib_sha256 crypto_merkle_tree stdlib_primitives) |
1 change: 1 addition & 0 deletions
1
barretenberg/cpp/src/barretenberg/benchmark/merkle_tree_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
barretenberg_module(merkle_tree_bench crypto_poseidon2 crypto_merkle_tree) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
barretenberg/cpp/src/barretenberg/benchmark/poseidon2_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
barretenberg_module(poseidon2_bench crypto_poseidon2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
barretenberg/cpp/src/barretenberg/crypto/merkle_tree/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
barretenberg_module(crypto_merkle_tree stdlib_primitives stdlib_blake3s stdlib_pedersen_hash) |
Oops, something went wrong.