From 4072d8eeca7cf620934bdcd049f75c6337bed809 Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Wed, 25 Oct 2023 11:18:48 -0400 Subject: [PATCH] feat: add mimalloc --- server/Cargo.lock | 20 ++++++++++++++++++++ server/Cargo.toml | 1 + server/src/main.rs | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/server/Cargo.lock b/server/Cargo.lock index 2b46fce9..e0aee158 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -2089,6 +2089,7 @@ dependencies = [ "dotenv", "env_logger", "log", + "mimalloc", ] [[package]] @@ -2127,6 +2128,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +[[package]] +name = "libmimalloc-sys" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "libsqlite3-sys" version = "0.26.0" @@ -2246,6 +2257,15 @@ dependencies = [ "serde_json", ] +[[package]] +name = "mimalloc" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.16" diff --git a/server/Cargo.toml b/server/Cargo.toml index 1b0d7137..def5e5cb 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -19,3 +19,4 @@ api = { path = "api" } dotenv = "0.15.0" env_logger = "0.10.0" log = "0.4.20" +mimalloc = "0.1.39" diff --git a/server/src/main.rs b/server/src/main.rs index f2a555cd..e7e1a76f 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1,3 +1,7 @@ +#[cfg(target_env = "gnu")] +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + fn main() { dotenv::from_filename(std::env::var("ENV").unwrap_or(".env".to_string())).ok();