12#include <benchmark/benchmark.h>
29 for (
size_t i = 0; i < num_nonzero; i++) {
47 std::vector<uint32_t> fixed_sizes = {
48 1 << 10, 1 << 7, 201000, 90000, 9000, 137000, 72000, 1 << 7, 2500, 11500,
50 std::vector<uint32_t> actual_sizes = {
51 10, 16, 48873, 18209, 4132, 23556, 35443, 3, 2, 2,
54 uint32_t full_size = 0;
55 for (
auto size : fixed_sizes) {
61 if ((1UL << log2_n) != (full_size)) {
64 full_size = 1 << log2_n;
68 uint32_t start_idx = 0;
71 for (
auto [block_size, actual_size] :
zip_view(fixed_sizes, actual_sizes)) {
72 end_idx = start_idx + actual_size;
73 for (
size_t i = start_idx; i < end_idx; ++i) {
76 active_range_endpoints.emplace_back(start_idx, end_idx);
77 start_idx += block_size;
79 if (non_zero_complement) {
81 for (
size_t i = end_idx; i < start_idx; ++i) {
82 polynomial.at(i) = const_random_coeff;
87 return { polynomial, active_range_endpoints };
100 const size_t num_points = 1 << state.range(0);
102 for (
auto _ : state) {
103 key.commit(polynomial);
113 const size_t num_points = 1 << state.range(0);
117 for (
size_t i = 0; i < num_nonzero; i++) {
118 polynomial.at(i) = 1;
121 for (
auto _ : state) {
122 key.commit(polynomial);
132 const size_t num_points = 1 << state.range(0);
136 for (
size_t i = 0; i < num_nonzero; i++) {
137 polynomial.at(i) = 1;
140 for (
auto _ : state) {
141 key.commit(polynomial);
151 const size_t num_points = 1 << state.range(0);
154 auto polynomial = sparse_random_poly<Fr>(num_points, num_nonzero);
156 for (
auto _ : state) {
157 key.commit(polynomial);
167 const size_t num_points = 1 << state.range(0);
170 auto polynomial = sparse_random_poly<Fr>(num_points, num_nonzero);
172 for (
auto _ : state) {
173 key.commit(polynomial);
183 const size_t num_points = 1 << state.range(0);
185 for (
auto _ : state) {
186 key.commit(polynomial);
197 const size_t num_points = 1 << state.range(0);
199 for (
auto _ : state) {
200 key.commit(polynomial);
210 auto [polynomial, active_range_endpoints] = structured_random_poly<Fr>();
212 for (
auto _ : state) {
213 key.commit(polynomial);
223 auto [polynomial, active_range_endpoints] = structured_random_poly<Fr>();
225 for (
auto _ : state) {
226 key.commit_structured(polynomial, active_range_endpoints);
236 auto [polynomial, active_range_endpoints] = structured_random_poly<Fr>(
true);
238 for (
auto _ : state) {
239 key.commit(polynomial);
249 auto [polynomial, active_range_endpoints] = structured_random_poly<Fr>(
true);
251 for (
auto _ : state) {
252 key.commit_structured_with_nonzero_complement(polynomial, active_range_endpoints);
274 for (
auto _ : state) {
276 const size_t num_points = 1 << state.range(0);
279 state.ResumeTiming();
281 std::vector<Commitment> G_vec_local(num_points);
286 bb::scalar_multiplication::pippenger_unsafe<Curve>(s_poly, { &G_vec_local[0], num_points });
290BENCHMARK(bench_pippenger_without_endomorphism_basis_points<curve::Grumpkin>)
292 ->Unit(benchmark::kMillisecond);
294BENCHMARK(bench_commit_zero<curve::BN254>)
296 ->Unit(benchmark::kMillisecond);
297BENCHMARK(bench_commit_sparse<curve::BN254>)
299 ->Unit(benchmark::kMillisecond);
300BENCHMARK(bench_commit_sparse_preprocessed<curve::BN254>)
302 ->Unit(benchmark::kMillisecond);
303BENCHMARK(bench_commit_sparse_random<curve::BN254>)
305 ->Unit(benchmark::kMillisecond);
306BENCHMARK(bench_commit_sparse_random_preprocessed<curve::BN254>)
308 ->Unit(benchmark::kMillisecond);
309BENCHMARK(bench_commit_random<curve::BN254>)
311 ->Unit(benchmark::kMillisecond);
312BENCHMARK(bench_commit_random_non_power_of_2<curve::BN254>)
314 ->Unit(benchmark::kMillisecond);
315BENCHMARK(bench_commit_structured_random_poly<curve::BN254>)->Unit(benchmark::kMillisecond);
316BENCHMARK(bench_commit_structured_random_poly_preprocessed<curve::BN254>)->Unit(benchmark::kMillisecond);
317BENCHMARK(bench_commit_mock_z_perm<curve::BN254>)->Unit(benchmark::kMillisecond);
318BENCHMARK(bench_commit_mock_z_perm_preprocessed<curve::BN254>)->Unit(benchmark::kMillisecond);
CommitmentKey object over a pairing group 𝔾₁.
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
typename Group::affine_element AffineElement
virtual uint32_t get_random_uint32()=0
constexpr T get_msb(const T in)
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
constexpr size_t FF_COPY_COST
Entry point for Barretenberg command-line interface.
constexpr size_t MAX_NUM_GRUMPKIN_POINTS
CommitmentKey< Curve > create_commitment_key(const size_t num_points)
void bench_commit_structured_random_poly_preprocessed(::benchmark::State &state)
Polynomial< FF > sparse_random_poly(const size_t size, const size_t num_nonzero)
constexpr size_t MAX_LOG_NUM_POINTS
constexpr size_t MIN_LOG_NUM_GRUMPKIN_POINTS
void bench_commit_sparse_random(::benchmark::State &state)
void bench_commit_sparse_random_preprocessed(::benchmark::State &state)
constexpr size_t MAX_LOG_NUM_GRUMPKIN_POINTS
void bench_commit_random_non_power_of_2(::benchmark::State &state)
void bench_commit_random(::benchmark::State &state)
void bench_commit_mock_z_perm_preprocessed(::benchmark::State &state)
constexpr size_t MIN_LOG_NUM_POINTS
constexpr size_t MAX_NUM_POINTS
void bench_commit_mock_z_perm(::benchmark::State &state)
BENCHMARK(vector_of_evaluations) -> DenseRange(15, 21) ->Unit(kMillisecond) ->Iterations(1)
void bench_commit_sparse(::benchmark::State &state)
constexpr size_t SPARSE_NUM_NONZERO
void parallel_for_heuristic(size_t num_points, const std::function< void(size_t, size_t, size_t)> &func, size_t heuristic_cost)
Split a loop into several loops running in parallel based on operations in 1 iteration.
void bench_commit_sparse_preprocessed(::benchmark::State &state)
void bench_commit_zero(::benchmark::State &state)
void bench_commit_structured_random_poly(::benchmark::State &state)
void bench_pippenger_without_endomorphism_basis_points(::benchmark::State &state)
Benchmark pippenger_without_endomorphism_basis_points function, which is used notably in the IPA veri...
PolyData< FF > structured_random_poly(bool non_zero_complement=false)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::vector< std::pair< size_t, size_t > > active_range_endpoints
Polynomial< FF > polynomial
static field random_element(numeric::RNG *engine=nullptr) noexcept