From 20be69e1b94aa375077b8a55630a88b050d652a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 16 Aug 2022 20:09:36 +0200 Subject: [PATCH] Always use mimalloc as the global allocator --- cli/Cargo.toml | 3 +-- cli/src/main.rs | 3 +-- helpers/Cargo.toml | 3 +-- helpers/src/main.rs | 3 +-- http-ui/Cargo.toml | 3 +-- http-ui/src/main.rs | 3 +-- infos/Cargo.toml | 4 +--- infos/src/main.rs | 3 +-- milli/fuzz/Cargo.toml | 4 +--- milli/fuzz/fuzz_targets/indexing.rs | 3 +-- 10 files changed, 10 insertions(+), 22 deletions(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index e4de70031..9ca03894b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -18,6 +18,5 @@ byte-unit = { version = "4.0.14", features = ["serde"] } bimap = "0.6.2" csv = "1.1.6" stderrlog = "0.5.1" +mimalloc = { version = "0.1.29", default-features = false } -[target.'cfg(target_os = "linux")'.dependencies] -jemallocator = "0.3.2" diff --git a/cli/src/main.rs b/cli/src/main.rs index 35fef95c6..8485560f5 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -16,9 +16,8 @@ use milli::update::{self, IndexDocumentsConfig, IndexDocumentsMethod, IndexerCon use milli::{Index, Object}; use structopt::StructOpt; -#[cfg(target_os = "linux")] #[global_allocator] -static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; #[derive(Debug, StructOpt)] #[structopt(name = "Milli CLI", about = "A simple CLI to manipulate a milli index.")] diff --git a/helpers/Cargo.toml b/helpers/Cargo.toml index 46c50de43..4d32dc32a 100644 --- a/helpers/Cargo.toml +++ b/helpers/Cargo.toml @@ -14,5 +14,4 @@ milli = { path = "../milli" } stderrlog = "0.5.1" structopt = { version = "0.3.26", default-features = false } -[target.'cfg(target_os = "linux")'.dependencies] -jemallocator = "0.3.2" +mimalloc = { version = "0.1.29", default-features = false } \ No newline at end of file diff --git a/helpers/src/main.rs b/helpers/src/main.rs index b325aef89..0081965ad 100644 --- a/helpers/src/main.rs +++ b/helpers/src/main.rs @@ -5,9 +5,8 @@ use heed::{CompactionOption, Env, EnvOpenOptions}; use structopt::StructOpt; use Command::*; -#[cfg(target_os = "linux")] #[global_allocator] -static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; #[derive(Debug, StructOpt)] /// Some helpers commands for milli. diff --git a/http-ui/Cargo.toml b/http-ui/Cargo.toml index 43e046c11..b3763409e 100644 --- a/http-ui/Cargo.toml +++ b/http-ui/Cargo.toml @@ -30,6 +30,7 @@ serde_json = { version = "1.0.79", features = ["preserve_order"] } tokio = { version = "1.17.0", features = ["full"] } tokio-stream = { version = "0.1.8", default-features = false, features = ["sync"] } warp = "0.3.2" +mimalloc = { version = "0.1.29", default-features = false } # logging log = "0.4.14" @@ -45,5 +46,3 @@ csv = "1.1.6" maplit = "1.0.2" serde_test = "1.0.136" -[target.'cfg(target_os = "linux")'.dependencies] -jemallocator = "0.3.2" diff --git a/http-ui/src/main.rs b/http-ui/src/main.rs index 83fce9a9c..de5d3c5ab 100644 --- a/http-ui/src/main.rs +++ b/http-ui/src/main.rs @@ -42,9 +42,8 @@ use warp::Filter; use self::update_store::UpdateStore; -#[cfg(target_os = "linux")] #[global_allocator] -static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; static GLOBAL_CONFIG: OnceCell = OnceCell::new(); diff --git a/infos/Cargo.toml b/infos/Cargo.toml index ea1ee9193..7cbe52693 100644 --- a/infos/Cargo.toml +++ b/infos/Cargo.toml @@ -15,6 +15,4 @@ roaring = "0.9.0" serde_json = "1.0.79" stderrlog = "0.5.1" structopt = { version = "0.3.26", default-features = false } - -[target.'cfg(target_os = "linux")'.dependencies] -jemallocator = "0.3.2" +mimalloc = { version = "0.1.29", default-features = false } diff --git a/infos/src/main.rs b/infos/src/main.rs index feec17557..2862fed7a 100644 --- a/infos/src/main.rs +++ b/infos/src/main.rs @@ -11,9 +11,8 @@ use milli::{FieldId, Index}; use structopt::StructOpt; use Command::*; -#[cfg(target_os = "linux")] #[global_allocator] -static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; const ALL_DATABASE_NAMES: &[&str] = &[ MAIN, diff --git a/milli/fuzz/Cargo.toml b/milli/fuzz/Cargo.toml index e734936fb..7e1bea3c5 100644 --- a/milli/fuzz/Cargo.toml +++ b/milli/fuzz/Cargo.toml @@ -16,9 +16,7 @@ serde_json = { version = "1.0.62", features = ["preserve_order"] } anyhow = "1.0" tempfile = "3.3" arbitrary-json = "0.1.0" - -[target.'cfg(target_os = "linux")'.dependencies] -jemallocator = "0.3.2" +mimalloc = { version = "0.1.29", default-features = false } [dependencies.milli] path = ".." diff --git a/milli/fuzz/fuzz_targets/indexing.rs b/milli/fuzz/fuzz_targets/indexing.rs index e4f42655e..a447aebe2 100644 --- a/milli/fuzz/fuzz_targets/indexing.rs +++ b/milli/fuzz/fuzz_targets/indexing.rs @@ -12,9 +12,8 @@ use milli::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Setting use milli::Index; use serde_json::{Map, Value}; -#[cfg(target_os = "linux")] #[global_allocator] -static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; /// reads json from input and write an obkv batch to writer. pub fn read_json(input: impl Read, writer: impl Write + Seek) -> Result {