From 34c75cc2b9c6a3ee9e250863a6867474ebffd1a9 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Tue, 29 Mar 2022 13:16:52 +0200 Subject: [PATCH] chore: Use mimalloc; 2x faster than glib malloc --- Cargo.lock | 19 +++++++++++++++++++ bin/Cargo.toml | 1 + bin/src/main.rs | 5 +++++ 3 files changed, 25 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 25246a4..4c3cfdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -799,6 +799,15 @@ version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +[[package]] +name = "libmimalloc-sys" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7705fc40f6ed493f73584abbb324e74f96b358ff60dfe5659a0f8fc12c590a69" +dependencies = [ + "cc", +] + [[package]] name = "locale_config" version = "0.3.0" @@ -869,6 +878,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mimalloc" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0dfa131390c2f6bdb3242f65ff271fcdaca5ff7b6c08f28398be7f2280e3926" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.16" @@ -1153,6 +1171,7 @@ name = "pop-launcher-bin" version = "1.2.0" dependencies = [ "dirs 4.0.0", + "mimalloc", "pop-launcher-plugins", "pop-launcher-service", "tokio", diff --git a/bin/Cargo.toml b/bin/Cargo.toml index 1527b08..1d1bf38 100644 --- a/bin/Cargo.toml +++ b/bin/Cargo.toml @@ -13,6 +13,7 @@ pop-launcher-service = { path = "../service" } tracing = "0.1.32" tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } dirs = "4.0.0" +mimalloc = "0.1.28" [dependencies.tokio] version = "1.17.0" diff --git a/bin/src/main.rs b/bin/src/main.rs index d0cf714..ea200ee 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs @@ -4,6 +4,11 @@ use pop_launcher_plugins as plugins; use pop_launcher_service as service; +use mimalloc::MiMalloc; + +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + #[tokio::main(flavor = "current_thread")] async fn main() { if let Some(plugin) = std::env::args().next() {