From 6ce8d766b9afa2b25c553dbbfa02d79ccc838e44 Mon Sep 17 00:00:00 2001 From: Viet Dinh <54ckb0y789@gmail.com> Date: Thu, 16 May 2024 23:38:00 -0400 Subject: [PATCH] feat: default to 1-thread execution Reduces memory usage with minimal effect to performance --- Cargo.lock | 38 -------------------------------------- Cargo.toml | 2 +- src/main.rs | 2 +- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c53295..220a5cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -805,12 +805,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "http" version = "0.2.12" @@ -1173,16 +1167,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "num_enum" version = "0.7.2" @@ -1317,16 +1301,6 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - [[package]] name = "parking_lot_core" version = "0.9.9" @@ -1908,15 +1882,6 @@ dependencies = [ "digest", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - [[package]] name = "signature" version = "2.2.0" @@ -2181,10 +2146,7 @@ dependencies = [ "bytes", "libc", "mio", - "num_cpus", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.48.0", diff --git a/Cargo.toml b/Cargo.toml index 0f1975d..1dae44a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ tree-sitter = "0.20.10" env_logger = "0.11.3" ropey = "1.5.0" serde_json = "1.0.108" -tokio = { version = "1.17.0", features = ["full"] } +tokio = { version = "1.17.0", features = ["macros", "rt", "fs", "io-std"] } tower-lsp = { version = "0.20.0", features = ["proposed"] } serde = { version = "1.0", features = ["derive"] } dashmap = "5.1.0" diff --git a/src/main.rs b/src/main.rs index cb15692..16917b7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -724,7 +724,7 @@ impl LanguageServer for Backend { } } -#[tokio::main] +#[tokio::main(flavor = "current_thread")] async fn main() { let outlog = std::env::var("ODOO_LSP_LOG").ok().map(|var| { let path = match var.as_str() {