Skip to content

Commit 4d1aea2

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 4d1aea2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// at your option. All files in the project carrying such
66
// notice may not be copied, modified, or distributed except
77
// according to those terms.
8+
// extern crate jemallocator;
89

910
#[macro_use]
1011
mod internal;
@@ -35,6 +36,10 @@ use crate::internal::{
3536
pattern_has_uppercase_char, transform_args_with_exec, FileTypes,
3637
};
3738

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

0 commit comments

Comments
 (0)