From d9744f3b03239422a5d7f0eda3293a90c62e8600 Mon Sep 17 00:00:00 2001 From: Alex Povel Date: Wed, 17 Jul 2024 09:47:25 +0200 Subject: [PATCH] ignore: improve multithreading heuristic This copies the one found in ripgrep. See also: https://github.com/BurntSushi/ripgrep/blob/71d71d2d98964653cdfcfa315802f518664759d7/crates/core/flags/hiargs.rs#L172 Closes #2854, Closes #2856 --- crates/ignore/src/walk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ignore/src/walk.rs b/crates/ignore/src/walk.rs index 03a6e2d0..448e599e 100644 --- a/crates/ignore/src/walk.rs +++ b/crates/ignore/src/walk.rs @@ -1305,7 +1305,7 @@ impl WalkParallel { fn threads(&self) -> usize { if self.threads == 0 { - 2 + std::thread::available_parallelism().map_or(1, |n| n.get()).min(12) } else { self.threads }