From f249189e43ec3c635bc04e7e79c7e4d33163f64a Mon Sep 17 00:00:00 2001 From: WSRer <1749094641@qq.com> Date: Mon, 20 Jan 2025 10:23:26 +0800 Subject: [PATCH] use mimalloc --- Cargo.lock | 48 ++++++++++++++++++++---------------------------- Cargo.toml | 2 +- src/main.rs | 5 +++-- 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f370b4..0f3ab41 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -172,15 +172,6 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" -[[package]] -name = "cmake" -version = "0.1.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" -dependencies = [ - "cc", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -264,11 +255,11 @@ dependencies = [ "env_logger", "lazy_static", "log", + "mimalloc", "serde", "serde_json", "simd-json", "smallvec", - "snmalloc-rs", "tempfile", "which", ] @@ -439,6 +430,16 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libmimalloc-sys" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "linux-raw-sys" version = "0.4.12" @@ -457,6 +458,15 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "mimalloc" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -655,24 +665,6 @@ version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" -[[package]] -name = "snmalloc-rs" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43ff92911d7d9705d1c0203300a3edfd00d16c8b8b0c27c56f9407a3f31e7a6" -dependencies = [ - "snmalloc-sys", -] - -[[package]] -name = "snmalloc-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "954e1f984860770475196be81a547ed1517d34fcb8a15cb87bdb37cff3353230" -dependencies = [ - "cmake", -] - [[package]] name = "strsim" version = "0.9.3" diff --git a/Cargo.toml b/Cargo.toml index 6a92aab..4bbb23a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ clap = { version = "4.4", features = ["derive", "cargo"] } clap-verbosity-flag = "2.1.1" which = "6.0.1" simd-json = "0.14.3" -snmalloc-rs = { version = "0.3.7", features = ["native-cpu"] } +mimalloc = "0.1.43" [[example]] name = "native-json-parser" diff --git a/src/main.rs b/src/main.rs index 127cae9..d1e6212 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,9 +5,10 @@ use clap::Parser; use emacs_lsp_booster::app; use emacs_lsp_booster::bytecode; -#[global_allocator] -static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc; +use mimalloc::MiMalloc; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; #[derive(Parser)] #[command(long_about = None, about = None,