Compute the three quotient polys in parallel

Reduces that step from ~0.19s to ~0.09s on my laptop.
This commit is contained in:
Daniel Lubarov 2021-05-23 22:21:27 -07:00
parent c108dc6d81
commit 26845c5910

View File

@ -93,19 +93,22 @@ pub(crate) fn prove<F: Field + Extendable<D>, const D: usize>(
); );
// Compute the quotient polynomials, aka `t` in the Plonk paper. // Compute the quotient polynomials, aka `t` in the Plonk paper.
let quotient_polys_commitment = timed!( let all_quotient_poly_chunks = timed!(
{ vanishing_polys
let mut all_quotient_poly_chunks = Vec::with_capacity(num_challenges * quotient_degree); .into_par_iter()
for vanishing_poly in vanishing_polys.into_iter() { .flat_map(|vanishing_poly| {
let vanishing_poly_coeff = ifft(vanishing_poly); let vanishing_poly_coeff = ifft(vanishing_poly);
let quotient_poly_coeff = vanishing_poly_coeff.divide_by_z_h(degree); let quotient_poly_coeff = vanishing_poly_coeff.divide_by_z_h(degree);
// Split t into degree-n chunks. // Split t into degree-n chunks.
let quotient_poly_coeff_chunks = quotient_poly_coeff.chunks(degree); quotient_poly_coeff.chunks(degree)
all_quotient_poly_chunks.extend(quotient_poly_coeff_chunks); })
} .collect(),
ListPolynomialCommitment::new(all_quotient_poly_chunks, fri_config.rate_bits, true) "to compute quotient polys"
}, );
"to compute quotient polys and commit to them"
let quotient_polys_commitment = timed!(
ListPolynomialCommitment::new(all_quotient_poly_chunks, fri_config.rate_bits, true),
"to commit to quotient polys"
); );
challenger.observe_hash(&quotient_polys_commitment.merkle_tree.root); challenger.observe_hash(&quotient_polys_commitment.merkle_tree.root);