diff --git a/src/plonk/prover.rs b/src/plonk/prover.rs index 020c5b2..0f17481 100644 --- a/src/plonk/prover.rs +++ b/src/plonk/prover.rs @@ -141,6 +141,7 @@ impl Proof { C::Projective::batch_to_affine(&advice_commitments_projective, &mut advice_commitments); let advice_commitments = advice_commitments; drop(advice_commitments_projective); + metrics::counter!("advice_commitments", advice_commitments.len() as u64); for commitment in &advice_commitments { hash_point(&mut transcript, commitment)?; diff --git a/src/poly/commitment.rs b/src/poly/commitment.rs index c135ad0..ea2ad35 100644 --- a/src/poly/commitment.rs +++ b/src/poly/commitment.rs @@ -124,6 +124,7 @@ impl Params { poly: &Polynomial, r: Blind, ) -> C::Projective { + metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit"); let mut tmp_scalars = Vec::with_capacity(poly.len() + 1); let mut tmp_bases = Vec::with_capacity(poly.len() + 1); @@ -144,6 +145,7 @@ impl Params { poly: &Polynomial, r: Blind, ) -> C::Projective { + metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit_lagrange"); let mut tmp_scalars = Vec::with_capacity(poly.len() + 1); let mut tmp_bases = Vec::with_capacity(poly.len() + 1); diff --git a/src/poly/commitment/prover.rs b/src/poly/commitment/prover.rs index 1147c1e..6007fed 100644 --- a/src/poly/commitment/prover.rs +++ b/src/poly/commitment/prover.rs @@ -74,12 +74,14 @@ impl Proof { // // TODO: If we modify multiexp to take "extra" bases, we could speed // this piece up a bit by combining the multiexps. + metrics::counter!("multiexp", 2, "val" => "l/r", "size" => format!("{}", half)); let l = best_multiexp(&a[0..half], &g[half..]); let r = best_multiexp(&a[half..], &g[0..half]); let value_l = compute_inner_product(&a[0..half], &b[half..]); let value_r = compute_inner_product(&a[half..], &b[0..half]); let mut l_randomness = C::Scalar::random(); let r_randomness = C::Scalar::random(); + metrics::counter!("multiexp", 2, "val" => "l/r", "size" => "2"); let l = l + &best_multiexp(&[value_l, l_randomness], &[u, params.h]); let r = r + &best_multiexp(&[value_r, r_randomness], &[u, params.h]); let mut l = l.to_affine(); @@ -170,6 +172,7 @@ impl Proof { let d = C::Scalar::random(); let s = C::Scalar::random(); + metrics::increment!("multiexp", "val" => "delta", "size" => "3"); let delta = best_multiexp(&[d, d * &b, s], &[g, u, params.h]).to_affine(); let (delta_x, delta_y) = delta.get_xy().unwrap(); @@ -202,6 +205,7 @@ fn parallel_generator_collapse( ) { let len = g.len() / 2; let (mut g_lo, g_hi) = g.split_at_mut(len); + metrics::counter!("multiexp", len as u64, "size" => "2", "fn" => "parallel_generator_collapse"); parallelize(&mut g_lo, |g_lo, start| { let g_hi = &g_hi[start..]; diff --git a/src/poly/domain.rs b/src/poly/domain.rs index 6cc82f5..d336818 100644 --- a/src/poly/domain.rs +++ b/src/poly/domain.rs @@ -203,6 +203,7 @@ impl EvaluationDomain { assert_eq!(a.values.len(), 1 << self.k); // Perform inverse FFT to obtain the polynomial in coefficient form + metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "lagrange_to_coeff"); Self::ifft(&mut a.values, self.omega_inv, self.k, self.ifft_divisor); Polynomial { @@ -237,6 +238,7 @@ impl EvaluationDomain { Self::distribute_powers(&mut a.values, g); } a.values.resize(self.extended_len(), G::group_zero()); + metrics::increment!("fft", "size" => format!("{}", self.extended_len()), "fn" => "coeff_to_extended"); best_fft(&mut a.values, self.extended_omega, self.extended_k); Polynomial { @@ -255,6 +257,7 @@ impl EvaluationDomain { assert_eq!(a.values.len(), self.extended_len()); // Inverse FFT + metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "extended_to_coeff"); Self::ifft( &mut a.values, self.extended_omega_inv,