diff --git a/Cargo.lock b/Cargo.lock index 0adfd7058..a6b73bde2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1729,6 +1729,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" +[[package]] +name = "libmimalloc-sys" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ca136052550448f55df7898c6dbe651c6b574fe38a0d9ea687a9f8088a2e2c" +dependencies = [ + "cc", +] + [[package]] name = "libz-sys" version = "1.1.8" @@ -2055,6 +2064,7 @@ dependencies = [ "meilisearch-auth", "meilisearch-lib", "meilisearch-types", + "mimalloc", "mime", "num_cpus", "obkv", @@ -2082,7 +2092,6 @@ dependencies = [ "tar", "tempfile", "thiserror", - "tikv-jemallocator", "time 0.3.9", "tokio", "tokio-stream", @@ -2237,6 +2246,15 @@ dependencies = [ "uuid", ] +[[package]] +name = "mimalloc" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f64ad83c969af2e732e907564deb0d0ed393cec4af80776f77dd77a1a427698" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.16" @@ -3438,27 +3456,6 @@ dependencies = [ "syn 1.0.96", ] -[[package]] -name = "tikv-jemalloc-sys" -version = "0.4.3+5.2.1-patched.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" -dependencies = [ - "cc", - "fs_extra", - "libc", -] - -[[package]] -name = "tikv-jemallocator" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b7bcecfafe4998587d636f9ae9d55eb9d0499877b88757767c346875067098" -dependencies = [ - "libc", - "tikv-jemalloc-sys", -] - [[package]] name = "time" version = "0.1.43" diff --git a/Cargo.toml b/Cargo.toml index 99ec43528..b3bd3ce8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,10 @@ members = [ "permissive-json-pointer", ] +[profile.release] +codegen-units = 1 +lto = "thin" + [profile.dev.package.flate2] opt-level = 3 diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index 965b7a28f..4eee232e3 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -47,6 +47,7 @@ log = "0.4.14" meilisearch-auth = { path = "../meilisearch-auth" } meilisearch-types = { path = "../meilisearch-types" } meilisearch-lib = { path = "../meilisearch-lib" } +mimalloc = { version = "0.1.29", default-features = false } mime = "0.3.16" num_cpus = "1.13.1" obkv = "0.2.0" @@ -103,9 +104,6 @@ mini-dashboard = [ "zip", ] -[target.'cfg(target_os = "linux")'.dependencies] -tikv-jemallocator = "0.4.3" - [package.metadata.mini-dashboard] assets-url = "https://github.com/meilisearch/mini-dashboard/releases/download/v0.2.1/build.zip" sha1 = "05a02ff13c3982091884a3f81d28bf53e72607b2" diff --git a/meilisearch-http/src/main.rs b/meilisearch-http/src/main.rs index 7b99379ae..9627aeef8 100644 --- a/meilisearch-http/src/main.rs +++ b/meilisearch-http/src/main.rs @@ -10,9 +10,8 @@ use meilisearch_http::analytics::Analytics; use meilisearch_http::{create_app, setup_meilisearch, Opt}; use meilisearch_lib::MeiliSearch; -#[cfg(target_os = "linux")] #[global_allocator] -static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; /// does all the setup before meilisearch is launched fn setup(opt: &Opt) -> anyhow::Result<()> {