Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

zed: Reduce number of rayon threads, spawn with bigger stacks (#41812)

Lukas Wirthf8b414c22cdb
diff --git a/Cargo.lock b/Cargo.lock
index 1ee239c3740..947d90338af 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -21233,6 +21233,7 @@ dependencies = [
"project_symbols",
"prompt_store",
"proto",
+ "rayon",
"recent_projects",
"release_channel",
"remote",
diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml
index 9f6196c1482..ebb3d8beb32 100644
--- a/crates/zed/Cargo.toml
+++ b/crates/zed/Cargo.toml
@@ -73,6 +73,7 @@ gpui = { workspace = true, features = [
"windows-manifest",
] }
gpui_tokio.workspace = true
+rayon.workspace = true
edit_prediction_button.workspace = true
http_client.workspace = true
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index b873a58d3b6..18903d88809 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -257,6 +257,13 @@ pub fn main() {
return;
}
+ rayon::ThreadPoolBuilder::new()
+ .num_threads(4)
+ .stack_size(10 * 1024 * 1024)
+ .thread_name(|ix| format!("RayonWorker{}", ix))
+ .build_global()
+ .unwrap();
+
log::info!(
"========== starting zed version {}, sha {} ==========",
app_version,