diff --git a/Cargo.toml b/Cargo.toml index dd84f938a..2e6408c2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,9 @@ features = ["suggestions", "color", "wrap_help"] [target.'cfg(all(unix, not(target_os = "redox")))'.dependencies] libc = "0.2" +[target.'cfg(all(not(windows), not(target_env = "musl")))'.dependencies] +jemallocator = "0.3.0" + [dev-dependencies] diff = "0.1" tempdir = "0.3" diff --git a/src/main.rs b/src/main.rs index c4af1ef81..426eb080d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,6 +35,11 @@ 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/481 +#[cfg(all(not(windows), not(target_env = "musl")))] +#[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);