perf: replace par_bridge with collect + into_par_iter

This commit is contained in:
Matthias Seitz
2025-12-23 11:51:12 +01:00
parent 66db0839a0
commit 2c0c32b7a2
2 changed files with 6 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
use crate::tree::payload_processor::multiproof::{MultiProofTaskMetrics, SparseTrieUpdate};
use alloy_primitives::B256;
use rayon::iter::{ParallelBridge, ParallelIterator};
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use reth_trie::{updates::TrieUpdates, Nibbles};
use reth_trie_parallel::root::ParallelStateRootError;
use reth_trie_sparse::{
@@ -170,7 +170,8 @@ where
.storages
.into_iter()
.map(|(address, storage)| (address, storage, trie.take_storage_trie(&address)))
.par_bridge()
.collect::<Vec<_>>()
.into_par_iter()
.map(|(address, storage, storage_trie)| {
let _enter =
debug_span!(target: "engine::tree::payload_processor::sparse_trie", parent: span.clone(), "storage trie", ?address)

View File

@@ -274,7 +274,7 @@ where
#[cfg(feature = "std")]
// If std then reveal storage proofs in parallel
{
use rayon::iter::{ParallelBridge, ParallelIterator};
use rayon::iter::{IntoParallelIterator, ParallelIterator};
let retain_updates = self.retain_updates;
@@ -288,7 +288,8 @@ where
let trie = self.storage.take_or_create_trie(&account);
(account, storage_subtree, revealed_nodes, trie)
})
.par_bridge()
.collect::<Vec<_>>()
.into_par_iter()
.map(|(account, storage_subtree, mut revealed_nodes, mut trie)| {
let result = Self::reveal_decoded_storage_multiproof_inner(
account,