diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 896ccd739..1dc9941c3 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -13,6 +13,10 @@ csv = "1.1.6" [target.'cfg(target_os = "linux")'.dependencies] jemallocator = "0.3.2" +[target.'cfg(target_os = "macos")'.dependencies] +mimalloc = { version = "0.1.29", default-features = false } + + [dev-dependencies] heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" } criterion = { version = "0.3.5", features = ["html_reports"] } diff --git a/benchmarks/benches/formatting.rs b/benchmarks/benches/formatting.rs index f0ef8ea15..be9d965a9 100644 --- a/benchmarks/benches/formatting.rs +++ b/benchmarks/benches/formatting.rs @@ -6,6 +6,10 @@ use milli::{FormatOptions, MatcherBuilder, MatchingWord, MatchingWords}; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(target_os = "macos")] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + struct Conf<'a> { name: &'a str, text: &'a str, diff --git a/benchmarks/benches/indexing.rs b/benchmarks/benches/indexing.rs index c756583e6..d0a091298 100644 --- a/benchmarks/benches/indexing.rs +++ b/benchmarks/benches/indexing.rs @@ -18,6 +18,10 @@ use roaring::RoaringBitmap; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(target_os = "macos")] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + const BENCHMARK_ITERATION: usize = 10; fn setup_dir(path: impl AsRef) { diff --git a/benchmarks/benches/search_geo.rs b/benchmarks/benches/search_geo.rs index 84448c32d..65aeef01e 100644 --- a/benchmarks/benches/search_geo.rs +++ b/benchmarks/benches/search_geo.rs @@ -9,6 +9,10 @@ use utils::Conf; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(target_os = "macos")] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + fn base_conf(builder: &mut Settings) { let displayed_fields = ["geonameid", "name", "asciiname", "alternatenames", "_geo", "population"] diff --git a/benchmarks/benches/search_songs.rs b/benchmarks/benches/search_songs.rs index 6b11799ec..05ba39cdd 100644 --- a/benchmarks/benches/search_songs.rs +++ b/benchmarks/benches/search_songs.rs @@ -9,6 +9,10 @@ use utils::Conf; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(target_os = "macos")] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + fn base_conf(builder: &mut Settings) { let displayed_fields = ["id", "title", "album", "artist", "genre", "country", "released", "duration"] diff --git a/benchmarks/benches/search_wiki.rs b/benchmarks/benches/search_wiki.rs index 9ef75efeb..20d62fba6 100644 --- a/benchmarks/benches/search_wiki.rs +++ b/benchmarks/benches/search_wiki.rs @@ -9,6 +9,10 @@ use utils::Conf; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(target_os = "macos")] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + fn base_conf(builder: &mut Settings) { let displayed_fields = ["title", "body", "url"].iter().map(|s| s.to_string()).collect(); builder.set_displayed_fields(displayed_fields);