Use jemalloc

Benchmark #1: ./fd-sys-alloc '[0-9]\.jpg$' /home/shark
  Time (mean ± σ):     246.8 ms ±   3.4 ms    [User: 960.1 ms, System: 810.0 ms]
  Range (min … max):   244.1 ms … 257.1 ms    12 runs

Benchmark #2: ./fd-jemalloc '[0-9]\.jpg$' /home/shark
  Time (mean ± σ):     201.0 ms ±   3.0 ms    [User: 833.9 ms, System: 666.9 ms]
  Range (min … max):   196.1 ms … 206.9 ms    14 runs

Summary
  './fd-jemalloc '[0-9]\.jpg$' /home/shark' ran
    1.23 ± 0.03 times faster than './fd-sys-alloc '[0-9]\.jpg$' /home/shark'
This commit is contained in:
sharkdp 2019-09-15 17:47:36 +02:00 committed by David Peter
parent ac3e0e18e4
commit 5a154866e3
2 changed files with 5 additions and 0 deletions

View File

@ -44,6 +44,7 @@ ctrlc = "3.1"
humantime = "1.1.1"
lscolors = "0.6"
globset = "0.4"
jemallocator = "0.3.0"
[dependencies.clap]
version = "2.31.2"

View File

@ -35,6 +35,10 @@ use crate::internal::{
pattern_has_uppercase_char, transform_args_with_exec, FileTypes,
};
// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/480
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
fn main() {
let checked_args = transform_args_with_exec(env::args_os());
let matches = app::build_app().get_matches_from(checked_args);