From 1c01ad5bab06abc3350cc788df293899729b4772 Mon Sep 17 00:00:00 2001 From: Jay White Date: Thu, 5 Sep 2024 02:26:55 -0400 Subject: [PATCH] perf: parallelize v2 construction within `eval_vmv_re_prove` (#127) # Rationale for this change This reduces the `eval_vmv_re_prove` component of the proof time from one of the larger factors to a negligible amount. # What changes are included in this PR? The computation of v2 within `eval_vmv_re_prove` now uses a rayon iterator. # Are these changes tested? Yes --- crates/proof-of-sql/src/proof_primitive/dory/eval_vmv_re.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/proof-of-sql/src/proof_primitive/dory/eval_vmv_re.rs b/crates/proof-of-sql/src/proof_primitive/dory/eval_vmv_re.rs index d42f0edc7..e575541d2 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/eval_vmv_re.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/eval_vmv_re.rs @@ -4,6 +4,7 @@ use super::{ }; use ark_ec::VariableBaseMSM; use merlin::Transcript; +use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; /// This is the prover side of the Eval-VMV-RE algorithm in section 5 of https://eprint.iacr.org/2020/1274.pdf. /// @@ -32,10 +33,11 @@ pub fn eval_vmv_re_prove( messages.prover_send_GT_message(transcript, C); messages.prover_send_GT_message(transcript, D_2); messages.prover_send_G1_message(transcript, E_1); + let Gamma_2_fin = setup.Gamma_2_fin; let v2 = state .v_vec - .iter() - .map(|c| (setup.Gamma_2_fin * c).into()) + .par_iter() + .map(|c| (Gamma_2_fin * c).into()) .collect::>(); ExtendedProverState::from_vmv_prover_state(state, v2) }