Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
client_ivc.bench.cpp
Go to the documentation of this file.
1
6#include <benchmark/benchmark.h>
7
10
11using namespace benchmark;
12using namespace bb;
13
14namespace {
15
19class ClientIVCBench : public benchmark::Fixture {
20 public:
21 // Number of function circuits to accumulate (based on Zac's target numbers)
22 static constexpr size_t NUM_ITERATIONS_MEDIUM_COMPLEXITY = 5;
23
24 void SetUp([[maybe_unused]] const ::benchmark::State& state) override
25 {
27 }
28};
29
33BENCHMARK_DEFINE_F(ClientIVCBench, VerificationOnly)(benchmark::State& state)
34{
35 size_t NUM_APP_CIRCUITS = 1;
36 auto precomputed_vks = precompute_vks(NUM_APP_CIRCUITS);
37 auto [proof, vk] = accumulate_and_prove_ivc_with_precomputed_vks(NUM_APP_CIRCUITS, precomputed_vks);
38
39 for (auto _ : state) {
40 benchmark::DoNotOptimize(ClientIVC::verify(proof, vk));
41 }
42}
43
47BENCHMARK_DEFINE_F(ClientIVCBench, Full)(benchmark::State& state)
48{
49 size_t NUM_APP_CIRCUITS = static_cast<size_t>(state.range(0));
50 auto precomputed_vks = precompute_vks(NUM_APP_CIRCUITS);
51
52 for (auto _ : state) {
54 accumulate_and_prove_ivc_with_precomputed_vks(NUM_APP_CIRCUITS, precomputed_vks);
55 }
56}
57
58#define ARGS Arg(ClientIVCBench::NUM_ITERATIONS_MEDIUM_COMPLEXITY)->Arg(2)
59
60BENCHMARK_REGISTER_F(ClientIVCBench, Full)->Unit(benchmark::kMillisecond)->ARGS;
61BENCHMARK_REGISTER_F(ClientIVCBench, VerificationOnly)->Unit(benchmark::kMillisecond);
62
63} // namespace
64
static bool verify(const Proof &proof, const VerificationKey &vk)
BENCHMARK_MAIN()
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
std::pair< ClientIVC::Proof, ClientIVC::VerificationKey > accumulate_and_prove_ivc_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)
VerifierCommitmentKey< Curve > vk
#define BB_REPORT_OP_COUNT_IN_BENCH(state)