zed: Allocate more rayon threads depending on available parallelism (#43235)

While zed itself is not a heavy user of rayon, wasmtime is, especially
for compilation. This change is similar to the rayon default but we
halve the number of threads still so we don't spawn too many threads
overall.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-11-21 10:33:38 +00:00
committed by GitHub
parent a30887f03b
commit 1ce58a88cc
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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()