Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
41316ff
docs: add prover parallelism improvement plan (6 tasks)
diegokingston Apr 21, 2026
1451d7c
perf: parallelize LogUp fingerprint computation with rayon
diegokingston Apr 21, 2026
3ab5504
perf: parallelize table_contribution sum with rayon reduce
diegokingston Apr 21, 2026
60c9255
perf: chunked parallel batch inverse for LogUp fingerprints
diegokingston Apr 21, 2026
35f8614
revert: undo LogUp parallelization (caused +3.9% regression due to ne…
diegokingston Apr 21, 2026
00b33d4
perf: fused chunk-local LogUp processing with parallel prefix sum
diegokingston Apr 21, 2026
0948389
perf: optimize FRI fold arithmetic and leaf construction
diegokingston Apr 21, 2026
c2bdf66
perf: eliminate per-row heap allocation in Merkle leaf hashing
diegokingston Apr 21, 2026
bd7bc46
revert: undo FRI fold twiddle precomputation (caused regression, need…
diegokingston Apr 21, 2026
64f3839
revert: undo per-row buffer reuse in Merkle hashing (allocation was n…
diegokingston Apr 21, 2026
10fe99f
fix: extract fingerprint computation closure to reduce cfg duplicatio…
diegokingston Apr 21, 2026
c81453f
perf: skip Rayon for small Merkle trees (< 1024 nodes)
diegokingston Apr 21, 2026
8e70557
perf: deduplicate Domain + LdeTwiddles across tables by (trace_length…
diegokingston Apr 21, 2026
2ed6460
chore: remove outdated parallelism plan (approach changed)
diegokingston Apr 21, 2026
895f8aa
fix: resolve clippy warnings (div_ceil, loop variable, complex type)
diegokingston Apr 21, 2026
85e5c61
style: cargo fmt --all
diegokingston Apr 21, 2026
4ec3d92
fix: update run_debug_checks to accept Arc<Domain> and Arc<LdeTwiddles>
diegokingston Apr 22, 2026
95c7718
Merge branch 'main' into investigate/prover-performance
diegokingston Apr 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions crypto/crypto/src/merkle_tree/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ pub trait IsMerkleTreeBackend {
/// tree will be built from and converts it to a list of leaf nodes.
fn hash_leaves(unhashed_leaves: &[Self::Data]) -> Vec<Self::Node> {
#[cfg(feature = "parallel")]
let iter = unhashed_leaves.par_iter();
#[cfg(not(feature = "parallel"))]
let iter = unhashed_leaves.iter();

iter.map(|leaf| Self::hash_data(leaf)).collect()
{
if unhashed_leaves.len() >= 1024 {
return unhashed_leaves
.par_iter()
.map(|leaf| Self::hash_data(leaf))
.collect();
}
}
unhashed_leaves
.iter()
.map(|leaf| Self::hash_data(leaf))
.collect()
}

/// This function takes to children nodes and builds a new parent node.
Expand Down
37 changes: 28 additions & 9 deletions crypto/crypto/src/merkle_tree/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,36 @@ where
let (new_level_iter, children_iter) =
nodes[new_level_begin_index..level_end_index + 1].split_at_mut(new_level_length);

// Skip Rayon for small levels: the scheduling overhead exceeds
// computation for levels with fewer than 1024 nodes. This avoids
// hundreds of unnecessary task spawns from small FRI layer trees.
#[cfg(feature = "parallel")]
let parent_and_children_zipped_iter = new_level_iter
.into_par_iter()
.zip(children_iter.par_chunks_exact(2));
{
if new_level_length >= 1024 {
new_level_iter
.into_par_iter()
.zip(children_iter.par_chunks_exact(2))
.for_each(|(new_parent, children)| {
*new_parent = B::hash_new_parent(&children[0], &children[1]);
});
} else {
new_level_iter
.iter_mut()
.zip(children_iter.chunks_exact(2))
.for_each(|(new_parent, children)| {
*new_parent = B::hash_new_parent(&children[0], &children[1]);
});
}
}
#[cfg(not(feature = "parallel"))]
let parent_and_children_zipped_iter =
new_level_iter.iter_mut().zip(children_iter.chunks_exact(2));

parent_and_children_zipped_iter.for_each(|(new_parent, children)| {
*new_parent = B::hash_new_parent(&children[0], &children[1]);
});
{
new_level_iter
.iter_mut()
.zip(children_iter.chunks_exact(2))
.for_each(|(new_parent, children)| {
*new_parent = B::hash_new_parent(&children[0], &children[1]);
});
}

level_end_index = level_begin_index - 1;
level_begin_index = new_level_begin_index;
Expand Down
Loading
Loading