Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
zed: Allocate more rayon threads depending on available parallelism (#43235)
Lukas Wirth1ce58a88ccdf
diff --git a/crates/remote_server/src/unix.rs b/crates/remote_server/src/unix.rsindex 29e5ef735f5..c631d47b8c2 100644--- a/crates/remote_server/src/unix.rs+++ b/crates/remote_server/src/unix.rs@@ -373,7 +373,7 @@ pub fn execute_run(let listeners = ServerListeners::new(stdin_socket, stdout_socket, stderr_socket)?;rayon::ThreadPoolBuilder::new()- .num_threads(4)+ .num_threads(std::thread::available_parallelism().map_or(1, |n| n.get().div_ceil(2))).stack_size(10 * 1024 * 1024).thread_name(|ix| format!("RayonWorker{}", ix)).build_global()diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex 9dba1b427d3..89944f835b0 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -265,7 +265,7 @@ pub fn main() {}rayon::ThreadPoolBuilder::new()- .num_threads(4)+ .num_threads(std::thread::available_parallelism().map_or(1, |n| n.get().div_ceil(2))).stack_size(10 * 1024 * 1024).thread_name(|ix| format!("RayonWorker{}", ix)).build_global()