Skip to content

Commit

Permalink
Parallelize index lookup => 30% faster
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Jan 9, 2025
1 parent 4182d8a commit b352e15
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions executor/src/witgen/multiplicity_column_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,14 @@ impl<'a, T: FieldElement> MultiplicityColumnGenerator<'a, T> {
.or_insert_with(|| vec![0; rhs_machine_size]);
assert_eq!(multiplicities.len(), rhs_machine_size);

for (_, tuple) in lhs_tuples {
multiplicities[index[&tuple]] += 1;
// Looking up the index is slow, so we do it in parallel.
let indices = lhs_tuples
.into_par_iter()
.map(|(_, tuple)| index[&tuple])
.collect::<Vec<_>>();

for index in indices {
multiplicities[index] += 1;
}
log::trace!(
" Done updating multiplicities, took: {}s",
Expand Down

0 comments on commit b352e15

Please sign in to comment.