From d2372a3024a743d235c9c8c7f17349bce9fb93e1 Mon Sep 17 00:00:00 2001 From: Federico Gimenez Date: Tue, 17 Dec 2024 14:01:40 +0000 Subject: [PATCH] reduce num_threads --- crates/trie/parallel/src/proof.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/trie/parallel/src/proof.rs b/crates/trie/parallel/src/proof.rs index 8a45e0bf41cbb..1da1573b47a43 100644 --- a/crates/trie/parallel/src/proof.rs +++ b/crates/trie/parallel/src/proof.rs @@ -114,8 +114,8 @@ where ); let storage_root_targets_len = storage_root_targets.len(); - let num_threads = std::thread::available_parallelism() - .map_or(0, |num| num.get().saturating_sub(1).max(1)); + let num_threads = + std::thread::available_parallelism().map_or(1, |num| (num.get() / 2).max(1)); // create a local thread pool with a fixed number of workers let pool = rayon::ThreadPoolBuilder::new()