Skip to content

Commit

Permalink
Use jemalloc
Browse files Browse the repository at this point in the history
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'
  • Loading branch information
sharkdp committed Sep 15, 2019
1 parent ac3e0e1 commit b9138a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ use crate::internal::{
pattern_has_uppercase_char, transform_args_with_exec, FileTypes,
};

// We use jemalloc for performance reasons, see https:/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);
Expand Down

0 comments on commit b9138a9

Please sign in to comment.