Skip to content

Commit b9138a9

Browse files
committed
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'
1 parent ac3e0e1 commit b9138a9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ctrlc = "3.1"
4444
humantime = "1.1.1"
4545
lscolors = "0.6"
4646
globset = "0.4"
47+
jemallocator = "0.3.0"
4748

4849
[dependencies.clap]
4950
version = "2.31.2"

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ use crate::internal::{
3535
pattern_has_uppercase_char, transform_args_with_exec, FileTypes,
3636
};
3737

38+
// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/480
39+
#[global_allocator]
40+
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
41+
3842
fn main() {
3943
let checked_args = transform_args_with_exec(env::args_os());
4044
let matches = app::build_app().get_matches_from(checked_args);

0 commit comments

Comments
 (0)