Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
poseidon2.bench.cpp
Go to the documentation of this file.
3#include <benchmark/benchmark.h>
4
5using namespace benchmark;
6using namespace bb;
7
8grumpkin::fq poseidon_function(const size_t count)
9{
10 std::vector<grumpkin::fq> inputs(count);
11 for (size_t i = 0; i < count; ++i) {
12 inputs[i] = grumpkin::fq::random_element();
13 }
14 // hash count many field elements
16 return inputs[0];
17}
18
19void native_poseidon2_commitment_bench(State& state) noexcept
20{
21 for (auto _ : state) {
22 const size_t count = (static_cast<size_t>(state.range(0)));
23 (poseidon_function(count));
24 }
25}
26BENCHMARK(native_poseidon2_commitment_bench)->Arg(10)->Arg(1000)->Arg(10000);
27
33
34void poseiden_hash_bench(State& state) noexcept
35{
38 for (auto _ : state) {
39 DoNotOptimize(poseiden_hash_impl(x, y));
40 }
41}
42BENCHMARK(poseiden_hash_bench)->Unit(benchmark::kMillisecond);
43
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
grumpkin::fq poseidon_function(const size_t count)
void poseiden_hash_bench(State &state) noexcept
BENCHMARK_MAIN()
BENCHMARK(native_poseidon2_commitment_bench) -> Arg(10) ->Arg(1000) ->Arg(10000)
void native_poseidon2_commitment_bench(State &state) noexcept
grumpkin::fq poseiden_hash_impl(const grumpkin::fq &x, const grumpkin::fq &y)
static field random_element(numeric::RNG *engine=nullptr) noexcept