Skip to content

Commit e3b3f6d

Browse files
committed
perf(stark): move per-table Challenges coeffs instead of cloning (batched verifier)
Parity-sweep follow-up to the batched g·z OOD pruning. `batched_verify_round_4` built `boundary_coeffs_all`, `transition_coeffs_all`, the pruned `trace_term_coeffs` grid and `gammas_all`, then index-CLONED each into every table's `Challenges` — but those vectors are never read again afterward. Move them via `izip!` instead; only `z` (one field element) and the shared `rap_challenges` are still cloned per table. Removes a per-table clone of the DEEP trace-term coefficient grid, which matters most on the guest-side recursion verifier. Behavior-preserving (identical values); stark suite 225 passing.
1 parent 6bc7bdb commit e3b3f6d

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

crypto/stark/src/verifier.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,19 +2036,29 @@ pub trait IsStarkVerifier<
20362036
.iter()
20372037
.map(Self::batched_synthetic_table_proof)
20382038
.collect();
2039-
let table_challenges: Vec<Challenges<FieldExtension>> = (0..num_tables)
2040-
.map(|i| Challenges {
2039+
// Move (not clone) each table's per-table coefficient vectors into its
2040+
// `Challenges`; they are never read again after this. Only `z` (one field
2041+
// element) and the shared `rap_challenges` are cloned per table.
2042+
let table_challenges: Vec<Challenges<FieldExtension>> = itertools::izip!(
2043+
boundary_coeffs_all,
2044+
transition_coeffs_all,
2045+
trace_term_coeffs_all,
2046+
gammas_all,
2047+
)
2048+
.map(
2049+
|(boundary_coeffs, transition_coeffs, trace_term_coeffs, gammas)| Challenges {
20412050
z: z.clone(),
2042-
boundary_coeffs: boundary_coeffs_all[i].clone(),
2043-
transition_coeffs: transition_coeffs_all[i].clone(),
2044-
trace_term_coeffs: trace_term_coeffs_all[i].clone(),
2045-
gammas: gammas_all[i].clone(),
2051+
boundary_coeffs,
2052+
transition_coeffs,
2053+
trace_term_coeffs,
2054+
gammas,
20462055
zetas: Vec::new(),
20472056
iotas: Vec::new(),
20482057
rap_challenges: lookup_challenges.clone(),
20492058
grinding_seed: [0u8; 32],
2050-
})
2051-
.collect();
2059+
},
2060+
)
2061+
.collect();
20522062

20532063
// The full current+next-row OOD grid, reconstructed once per table from
20542064
// the two pruned proof blocks and shared by step 2, the query-invariant

0 commit comments

Comments
 (0)