From 77eb37934f81d8852f53af8a67fda14387b35fd8 Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 22 Jun 2021 14:17:56 +0200 Subject: [PATCH] add jemalloc to http-ui and the benchmarks --- Cargo.lock | 2 ++ benchmarks/Cargo.toml | 3 +++ benchmarks/benches/songs.rs | 4 ++++ benchmarks/benches/wiki.rs | 4 ++++ http-ui/Cargo.toml | 3 +++ http-ui/src/main.rs | 4 ++++ 6 files changed, 20 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 43371f72c..428aae05f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,6 +132,7 @@ dependencies = [ "criterion", "flate2", "heed", + "jemallocator", "milli", "reqwest", ] @@ -969,6 +970,7 @@ dependencies = [ "futures", "grenad", "heed", + "jemallocator", "log", "maplit", "meilisearch-tokenizer 0.2.3", diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index ed366022c..d211b0b6e 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -8,6 +8,9 @@ publish = false [dependencies] milli = { path = "../milli" } +[target.'cfg(target_os = "linux")'.dependencies] +jemallocator = "0.3.2" + [dev-dependencies] heed = "*" # we want to use the version milli uses criterion = { version = "0.3.4", features = ["html_reports"] } diff --git a/benchmarks/benches/songs.rs b/benchmarks/benches/songs.rs index 726190f77..726040692 100644 --- a/benchmarks/benches/songs.rs +++ b/benchmarks/benches/songs.rs @@ -5,6 +5,10 @@ use criterion::{criterion_group, criterion_main}; use milli::update::Settings; use utils::Conf; +#[cfg(target_os = "linux")] +#[global_allocator] +static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; + fn base_conf(builder: &mut Settings) { let displayed_fields = ["id", "title", "album", "artist", "genre", "country", "released", "duration"] diff --git a/benchmarks/benches/wiki.rs b/benchmarks/benches/wiki.rs index 3d8b6f1d4..9ef75efeb 100644 --- a/benchmarks/benches/wiki.rs +++ b/benchmarks/benches/wiki.rs @@ -5,6 +5,10 @@ use criterion::{criterion_group, criterion_main}; use milli::update::Settings; use utils::Conf; +#[cfg(target_os = "linux")] +#[global_allocator] +static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; + 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); diff --git a/http-ui/Cargo.toml b/http-ui/Cargo.toml index 180d1ff29..0319e4e50 100644 --- a/http-ui/Cargo.toml +++ b/http-ui/Cargo.toml @@ -42,3 +42,6 @@ funty = "=1.1" [dev-dependencies] maplit = "1.0.2" serde_test = "1.0.125" + +[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 703861058..6a79e77ca 100644 --- a/http-ui/src/main.rs +++ b/http-ui/src/main.rs @@ -36,6 +36,10 @@ use warp::Filter; use self::update_store::UpdateStore; +#[cfg(target_os = "linux")] +#[global_allocator] +static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; + static GLOBAL_THREAD_POOL: OnceCell = OnceCell::new(); #[derive(Debug, StructOpt)]