mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
Merge #602
602: Use mimalloc as the default allocator r=Kerollmops a=loiclec ## What does this PR do? Use mimalloc as the global allocator for milli's benchmarks on macOS. ## Why? On Linux, we use jemalloc, which is a very fast allocator. But on macOS, we currently use the system allocator, which is very slow. In practice, this difference in allocator speed means that it is difficult to gain insight into milli's performance by running benchmarks locally on the Mac. By using mimalloc, which is another excellent allocator, we reduce the speed difference between the two platforms. Co-authored-by: Loïc Lecrenier <loic@meilisearch.com>
This commit is contained in:
commit
cd2635ccfc
@ -5,17 +5,15 @@ edition = "2018"
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
milli = { path = "../milli" }
|
|
||||||
anyhow = "1.0.56"
|
anyhow = "1.0.56"
|
||||||
serde_json = { version = "1.0.79", features = ["preserve_order"] }
|
|
||||||
csv = "1.1.6"
|
csv = "1.1.6"
|
||||||
|
milli = { path = "../milli" }
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
mimalloc = { version = "0.1.29", default-features = false }
|
||||||
jemallocator = "0.3.2"
|
serde_json = { version = "1.0.79", features = ["preserve_order"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
|
||||||
criterion = { version = "0.3.5", features = ["html_reports"] }
|
criterion = { version = "0.3.5", features = ["html_reports"] }
|
||||||
|
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
rand_chacha = "0.3.1"
|
rand_chacha = "0.3.1"
|
||||||
roaring = "0.9.0"
|
roaring = "0.9.0"
|
||||||
@ -23,8 +21,8 @@ roaring = "0.9.0"
|
|||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = "1.0.56"
|
anyhow = "1.0.56"
|
||||||
bytes = "1.1.0"
|
bytes = "1.1.0"
|
||||||
flate2 = "1.0.22"
|
|
||||||
convert_case = "0.5.0"
|
convert_case = "0.5.0"
|
||||||
|
flate2 = "1.0.22"
|
||||||
reqwest = { version = "0.11.9", features = ["blocking", "rustls-tls"], default-features = false }
|
reqwest = { version = "0.11.9", features = ["blocking", "rustls-tls"], default-features = false }
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
|
@ -2,9 +2,8 @@ use criterion::{criterion_group, criterion_main};
|
|||||||
use milli::tokenizer::TokenizerBuilder;
|
use milli::tokenizer::TokenizerBuilder;
|
||||||
use milli::{FormatOptions, MatcherBuilder, MatchingWord, MatchingWords};
|
use milli::{FormatOptions, MatcherBuilder, MatchingWord, MatchingWords};
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
struct Conf<'a> {
|
struct Conf<'a> {
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
|
@ -14,9 +14,8 @@ use rand::seq::SliceRandom;
|
|||||||
use rand_chacha::rand_core::SeedableRng;
|
use rand_chacha::rand_core::SeedableRng;
|
||||||
use roaring::RoaringBitmap;
|
use roaring::RoaringBitmap;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
const BENCHMARK_ITERATION: usize = 10;
|
const BENCHMARK_ITERATION: usize = 10;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ use criterion::{criterion_group, criterion_main};
|
|||||||
use milli::update::Settings;
|
use milli::update::Settings;
|
||||||
use utils::Conf;
|
use utils::Conf;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
fn base_conf(builder: &mut Settings) {
|
fn base_conf(builder: &mut Settings) {
|
||||||
let displayed_fields =
|
let displayed_fields =
|
||||||
|
@ -5,9 +5,8 @@ use criterion::{criterion_group, criterion_main};
|
|||||||
use milli::update::Settings;
|
use milli::update::Settings;
|
||||||
use utils::Conf;
|
use utils::Conf;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
fn base_conf(builder: &mut Settings) {
|
fn base_conf(builder: &mut Settings) {
|
||||||
let displayed_fields =
|
let displayed_fields =
|
||||||
|
@ -5,9 +5,8 @@ use criterion::{criterion_group, criterion_main};
|
|||||||
use milli::update::Settings;
|
use milli::update::Settings;
|
||||||
use utils::Conf;
|
use utils::Conf;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
fn base_conf(builder: &mut Settings) {
|
fn base_conf(builder: &mut Settings) {
|
||||||
let displayed_fields = ["title", "body", "url"].iter().map(|s| s.to_string()).collect();
|
let displayed_fields = ["title", "body", "url"].iter().map(|s| s.to_string()).collect();
|
||||||
|
@ -6,18 +6,16 @@ description = "A CLI to interact with a milli index"
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
bimap = "0.6.2"
|
||||||
|
byte-unit = { version = "4.0.14", features = ["serde"] }
|
||||||
|
color-eyre = "0.6.1"
|
||||||
|
csv = "1.1.6"
|
||||||
|
eyre = "0.6.7"
|
||||||
|
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1", default-features = false, features = ["lmdb", "sync-read-txn"] }
|
||||||
indicatif = "0.16.2"
|
indicatif = "0.16.2"
|
||||||
|
milli = { path = "../milli" }
|
||||||
|
mimalloc = { version = "0.1.29", default-features = false }
|
||||||
serde = "1.0.136"
|
serde = "1.0.136"
|
||||||
serde_json = "1.0.79"
|
serde_json = "1.0.79"
|
||||||
structopt = "0.3.26"
|
|
||||||
milli = { path = "../milli" }
|
|
||||||
eyre = "0.6.7"
|
|
||||||
color-eyre = "0.6.1"
|
|
||||||
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1", default-features = false, features = ["lmdb", "sync-read-txn"] }
|
|
||||||
byte-unit = { version = "4.0.14", features = ["serde"] }
|
|
||||||
bimap = "0.6.2"
|
|
||||||
csv = "1.1.6"
|
|
||||||
stderrlog = "0.5.1"
|
stderrlog = "0.5.1"
|
||||||
|
structopt = "0.3.26"
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
jemallocator = "0.3.2"
|
|
||||||
|
@ -16,9 +16,8 @@ use milli::update::{self, IndexDocumentsConfig, IndexDocumentsMethod, IndexerCon
|
|||||||
use milli::{Index, Object};
|
use milli::{Index, Object};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
#[structopt(name = "Milli CLI", about = "A simple CLI to manipulate a milli index.")]
|
#[structopt(name = "Milli CLI", about = "A simple CLI to manipulate a milli index.")]
|
||||||
|
@ -11,8 +11,6 @@ anyhow = "1.0.56"
|
|||||||
byte-unit = { version = "4.0.14", default-features = false, features = ["std"] }
|
byte-unit = { version = "4.0.14", default-features = false, features = ["std"] }
|
||||||
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
||||||
milli = { path = "../milli" }
|
milli = { path = "../milli" }
|
||||||
|
mimalloc = { version = "0.1.29", default-features = false }
|
||||||
stderrlog = "0.5.1"
|
stderrlog = "0.5.1"
|
||||||
structopt = { version = "0.3.26", default-features = false }
|
structopt = { version = "0.3.26", default-features = false }
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
jemallocator = "0.3.2"
|
|
||||||
|
@ -5,9 +5,8 @@ use heed::{CompactionOption, Env, EnvOpenOptions};
|
|||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use Command::*;
|
use Command::*;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
/// Some helpers commands for milli.
|
/// Some helpers commands for milli.
|
||||||
|
@ -13,6 +13,7 @@ crossbeam-channel = "0.5.2"
|
|||||||
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
||||||
memmap2 = "0.5.3"
|
memmap2 = "0.5.3"
|
||||||
milli = { path = "../milli" }
|
milli = { path = "../milli" }
|
||||||
|
mimalloc = { version = "0.1.29", default-features = false }
|
||||||
once_cell = "1.10.0"
|
once_cell = "1.10.0"
|
||||||
rayon = "1.5.1"
|
rayon = "1.5.1"
|
||||||
structopt = { version = "0.3.26", default-features = false, features = ["wrap_help"] }
|
structopt = { version = "0.3.26", default-features = false, features = ["wrap_help"] }
|
||||||
@ -32,18 +33,16 @@ tokio-stream = { version = "0.1.8", default-features = false, features = ["sync"
|
|||||||
warp = "0.3.2"
|
warp = "0.3.2"
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
|
fst = "0.4.7"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
stderrlog = "0.5.1"
|
stderrlog = "0.5.1"
|
||||||
fst = "0.4.7"
|
|
||||||
|
|
||||||
# Temporary fix for bitvec, remove once fixed. (https://github.com/bitvecto-rs/bitvec/issues/105)
|
# Temporary fix for bitvec, remove once fixed. (https://github.com/bitvecto-rs/bitvec/issues/105)
|
||||||
funty = "2.0.0"
|
|
||||||
bimap = "0.6.2"
|
bimap = "0.6.2"
|
||||||
csv = "1.1.6"
|
csv = "1.1.6"
|
||||||
|
funty = "2.0.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
maplit = "1.0.2"
|
maplit = "1.0.2"
|
||||||
serde_test = "1.0.136"
|
serde_test = "1.0.136"
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
jemallocator = "0.3.2"
|
|
||||||
|
@ -42,9 +42,8 @@ use warp::Filter;
|
|||||||
|
|
||||||
use self::update_store::UpdateStore;
|
use self::update_store::UpdateStore;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
static GLOBAL_CONFIG: OnceCell<IndexerConfig> = OnceCell::new();
|
static GLOBAL_CONFIG: OnceCell<IndexerConfig> = OnceCell::new();
|
||||||
|
|
||||||
|
@ -11,10 +11,8 @@ byte-unit = { version = "4.0.14", default-features = false, features = ["std"] }
|
|||||||
csv = "1.1.6"
|
csv = "1.1.6"
|
||||||
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
heed = { git = "https://github.com/meilisearch/heed", tag = "v0.12.1" }
|
||||||
milli = { path = "../milli" }
|
milli = { path = "../milli" }
|
||||||
|
mimalloc = { version = "0.1.29", default-features = false }
|
||||||
roaring = "0.9.0"
|
roaring = "0.9.0"
|
||||||
serde_json = "1.0.79"
|
serde_json = "1.0.79"
|
||||||
stderrlog = "0.5.1"
|
stderrlog = "0.5.1"
|
||||||
structopt = { version = "0.3.26", default-features = false }
|
structopt = { version = "0.3.26", default-features = false }
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
jemallocator = "0.3.2"
|
|
||||||
|
@ -11,9 +11,8 @@ use milli::{FieldId, Index};
|
|||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use Command::*;
|
use Command::*;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
const ALL_DATABASE_NAMES: &[&str] = &[
|
const ALL_DATABASE_NAMES: &[&str] = &[
|
||||||
MAIN,
|
MAIN,
|
||||||
|
@ -16,9 +16,7 @@ serde_json = { version = "1.0.62", features = ["preserve_order"] }
|
|||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
tempfile = "3.3"
|
tempfile = "3.3"
|
||||||
arbitrary-json = "0.1.0"
|
arbitrary-json = "0.1.0"
|
||||||
|
mimalloc = { version = "0.1.29", default-features = false }
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
jemallocator = "0.3.2"
|
|
||||||
|
|
||||||
[dependencies.milli]
|
[dependencies.milli]
|
||||||
path = ".."
|
path = ".."
|
||||||
|
@ -12,9 +12,8 @@ use milli::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Setting
|
|||||||
use milli::Index;
|
use milli::Index;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
#[global_allocator]
|
#[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.
|
/// reads json from input and write an obkv batch to writer.
|
||||||
pub fn read_json(input: impl Read, writer: impl Write + Seek) -> Result<usize> {
|
pub fn read_json(input: impl Read, writer: impl Write + Seek) -> Result<usize> {
|
||||||
|
Loading…
Reference in New Issue
Block a user