Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gate_counter.hpp
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3#include <utility>
4#include <vector>
5
6namespace acir_format {
7
12template <typename Builder> class GateCounter {
13 public:
18
19 size_t compute_diff()
20 {
22 return 0;
23 }
24 size_t new_gate_count = builder->get_num_finalized_gates_inefficient(/*ensure_nonzero=*/false);
25 size_t diff = new_gate_count - prev_gate_count;
26 prev_gate_count = new_gate_count;
27 return diff;
28 }
29
30 void track_diff(std::vector<size_t>& gates_per_opcode, size_t opcode_index)
31 {
33 gates_per_opcode[opcode_index] = compute_diff();
34 }
35 }
36
37 private:
41};
42} // namespace acir_format
Utility class for tracking the gate count of acir constraints.
void track_diff(std::vector< size_t > &gates_per_opcode, size_t opcode_index)
GateCounter(Builder *builder, bool collect_gates_per_opcode)