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
8fr poseidon_function(const size_t count)
9{
10 std::vector<fr> inputs(count);
11 for (size_t i = 0; i < count; ++i) {
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 DoNotOptimize(poseidon_function(count));
24 }
25}
26BENCHMARK(native_poseidon2_commitment_bench)->Arg(10)->Arg(1000)->Arg(10000);
27
28fr poseidon_hash_impl(const fr& x, const fr& y)
29{
30 std::vector<fr> to_hash{ x, y };
32}
33
34void poseidon_hash_bench(State& state) noexcept
35{
38 for (auto _ : state) {
39 DoNotOptimize(poseidon_hash_impl(x, y));
40 }
41}
42BENCHMARK(poseidon_hash_bench)->Unit(benchmark::kMillisecond);
43
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
AvmProvingInputs inputs
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
fr poseidon_hash_impl(const fr &x, const fr &y)
BENCHMARK_MAIN()
void poseidon_hash_bench(State &state) noexcept
BENCHMARK(native_poseidon2_commitment_bench) -> Arg(10) ->Arg(1000) ->Arg(10000)
void native_poseidon2_commitment_bench(State &state) noexcept
fr poseidon_function(const size_t count)
static field random_element(numeric::RNG *engine=nullptr) noexcept