Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
mega_honk.bench.cpp
Go to the documentation of this file.
1#include <benchmark/benchmark.h>
2
5
6using namespace benchmark;
7using namespace bb;
8
12static void construct_proof_megahonk(State& state, void (*test_circuit_function)(MegaCircuitBuilder&, size_t)) noexcept
13{
14 size_t num_iterations = 10; // 10x the circuit
15 bb::mock_circuits::construct_proof_with_specified_num_iterations<MegaProver>(
16 state, test_circuit_function, num_iterations);
17}
18
22static void construct_proof_megahonk_power_of_2(State& state) noexcept
23{
24 auto log2_of_gates = static_cast<size_t>(state.range(0));
25 bb::mock_circuits::construct_proof_with_specified_num_iterations<MegaProver>(
26 state, &bb::mock_circuits::generate_basic_arithmetic_circuit<MegaCircuitBuilder>, log2_of_gates);
27}
28
29static void get_row_power_of_2(State& state) noexcept
30{
31 auto log2_of_gates = static_cast<size_t>(state.range(0));
32 size_t gates = 1 << log2_of_gates;
34 for (auto& poly : polynomials.get_all()) {
35 poly = bb::Polynomial<bb::fr>(gates);
36 }
37 for (auto _ : state) {
38 for (size_t i = 0; i < gates; i++) {
39 benchmark::DoNotOptimize(polynomials.get_row(i));
40 }
41 }
42}
43
44// Define benchmarks
45
46// This exists due to an issue where get_row was blowing up in time
47BENCHMARK_CAPTURE(construct_proof_megahonk, sha256, &generate_sha256_test_circuit<MegaCircuitBuilder>)
48 ->Unit(kMillisecond);
49BENCHMARK_CAPTURE(construct_proof_megahonk,
50 ecdsa_verification,
51 &stdlib::generate_ecdsa_verification_test_circuit<MegaCircuitBuilder>)
52 ->Unit(kMillisecond);
53
54BENCHMARK(get_row_power_of_2)
55 // 2**15 gates to 2**20 gates
56 ->DenseRange(15, 20)
57 ->Unit(kMillisecond);
58
59BENCHMARK(construct_proof_megahonk_power_of_2)
60 // 2**15 gates to 2**20 gates
61 ->DenseRange(15, 20)
62 ->Unit(kMillisecond);
63
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
A container for polynomials handles used by the prover.
AllValuesType get_row(size_t row_idx) const
BENCHMARK_CAPTURE(construct_proof_megahonk, ecdsa_verification, &stdlib::generate_ecdsa_verification_test_circuit< MegaCircuitBuilder >) -> Unit(kMillisecond)
BENCHMARK_MAIN()
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
BENCHMARK(bench_commit_structured_random_poly< curve::BN254 >) -> Unit(benchmark::kMillisecond)
PureSha256 sha256