Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
chonk.bench.cpp
Go to the documentation of this file.
1
6#include <benchmark/benchmark.h>
7#include <chrono>
8
12
13using namespace benchmark;
14using namespace bb;
15
16namespace {
17
21class ChonkBench : public benchmark::Fixture {
22 public:
23 // Number of function circuits to accumulate (based on Zac's target numbers)
24 static constexpr size_t NUM_ITERATIONS_MEDIUM_COMPLEXITY = 5;
25
26 void SetUp([[maybe_unused]] const ::benchmark::State& state) override
27 {
29 }
30};
31
35BENCHMARK_DEFINE_F(ChonkBench, VerificationOnly)(benchmark::State& state)
36{
37 size_t NUM_APP_CIRCUITS = 1;
38 auto precomputed_vks = precompute_vks(NUM_APP_CIRCUITS);
39 auto [proof, vk_and_hash] = accumulate_and_prove_with_precomputed_vks(NUM_APP_CIRCUITS, precomputed_vks);
40
41 for (auto _ : state) {
42 ChonkNativeVerifier verifier(vk_and_hash);
43 benchmark::DoNotOptimize(verifier.verify(proof));
44 }
45}
46
50BENCHMARK_DEFINE_F(ChonkBench, Full)(benchmark::State& state)
51{
52 size_t NUM_APP_CIRCUITS = static_cast<size_t>(state.range(0));
53 auto precomputed_vks = precompute_vks(NUM_APP_CIRCUITS);
54
55 for (auto _ : state) {
57 accumulate_and_prove_with_precomputed_vks(NUM_APP_CIRCUITS, precomputed_vks);
58 }
59}
60
61#define ARGS Arg(ChonkBench::NUM_ITERATIONS_MEDIUM_COMPLEXITY)->Arg(2)
62
63BENCHMARK_REGISTER_F(ChonkBench, Full)->Unit(benchmark::kMillisecond)->ARGS;
64BENCHMARK_REGISTER_F(ChonkBench, VerificationOnly)->Unit(benchmark::kMillisecond);
65
66} // namespace
67
BENCHMARK_MAIN()
Verifier for Chonk IVC proofs (both native and recursive).
#define GOOGLE_BB_BENCH_REPORTER(state)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > accumulate_and_prove_with_precomputed_vks(size_t num_app_circuits, auto &precomputed_vks, const bool large_first_app=true)
Perform a specified number of circuit accumulation rounds.
std::vector< std::shared_ptr< typename MegaFlavor::VerificationKey > > precompute_vks(const size_t num_app_circuits, const bool large_first_app=true)