From e2133ce91a64c27744fddb5951597f2149ee15a4 Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Sun, 9 Aug 2026 14:09:06 +0300 Subject: [PATCH] using mimalloc --- Cargo.lock | 19 +++++++++++++++++++ Cargo.toml | 9 +++++---- src/main.rs | 4 ++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b338bb0..da6dee2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2203,6 +2203,7 @@ dependencies = [ "hex", "iced", "iced_core", + "mimalloc", "rand", "reqwest", "rhai", @@ -2378,6 +2379,15 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" +[[package]] +name = "libmimalloc-sys" +version = "0.1.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a45a52f43e1c16f667ccfe4dd8c85b7f7c204fd5e3bf46c5b0db9a5c3c0b8e9" +dependencies = [ + "cc", +] + [[package]] name = "libredox" version = "0.1.12" @@ -2523,6 +2533,15 @@ dependencies = [ "paste", ] +[[package]] +name = "mimalloc" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4139bb28d14ad1facf21d5eb8825051b326e172d216b39f6d31df53cc97862" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.17" diff --git a/Cargo.toml b/Cargo.toml index 4b0faaa..d7a2c39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ sha2 = "0.11.0" tokio = { version = "1.53.1", features = ["rt", "rt-multi-thread", "macros"] } hex = "0.4.3" zstd = "0.13.3" +mimalloc = "0.1.52" [dev-dependencies] criterion = "0.8.2" @@ -27,7 +28,7 @@ criterion = "0.8.2" name = "split_bench" # Имя файла в benches/ без расширения harness = false # Отключаем стандартный тестовый раннер -#[profile.release] -#codegen-units = 1 -#lto = true -#opt-level = 3 \ No newline at end of file +[profile.release] +codegen-units = 1 +lto = true +opt-level = 3 \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 42bc6d3..c592996 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,8 @@ //#![windows_subsystem = "windows"] +use mimalloc::MiMalloc; + +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; mod data_provider; mod dictionary; mod dictionary_test;