aports/community/fd/jemalloc-everywhere.patch
Sertonix 97c358e3e5 community/fd: switch to system jemalloc
https://gitlab.alpinelinux.org/alpine/aports/-/issues/17519#note_553814:

> fd is one of the apps most heavily impacted by malloc contention in
> scatter-gather workloads. We should probably fix jemalloc or switch
> it to a different malloc that still isn't the musl one.

Ref 9f97d69d4bb4 community/fd: use musl malloc
Ref #17519
2025-10-31 16:24:29 +01:00

51 lines
1.9 KiB
Diff

Since using system jemalloc we do not have the issues that upstream has
diff --git a/Cargo.toml b/Cargo.toml
index 5a72bba..522bb98 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -49,6 +49,7 @@ normpath = "1.1.1"
crossbeam-channel = "0.5.13"
clap_complete = {version = "4.5.8", optional = true}
faccess = "0.2.4"
+jemallocator = {version = "0.5.4", optional = true}
[dependencies.clap]
version = "4.5.13"
@@ -70,12 +71,6 @@ nix = { version = "0.29.0", default-features = false, features = ["signal", "use
[target.'cfg(all(unix, not(target_os = "redox")))'.dependencies]
libc = "0.2"
-# FIXME: Re-enable jemalloc on macOS
-# jemalloc is currently disabled on macOS due to a bug in jemalloc in combination with macOS
-# Catalina. See https://github.com/sharkdp/fd/issues/498 for details.
-[target.'cfg(all(not(windows), not(target_os = "android"), not(target_os = "macos"), not(target_os = "freebsd"), not(target_os = "openbsd"), not(all(target_env = "musl", target_pointer_width = "32")), not(target_arch = "riscv64")))'.dependencies]
-jemallocator = {version = "0.5.4", optional = true}
-
[dev-dependencies]
diff = "0.1"
tempfile = "3.10"
diff --git a/src/main.rs b/src/main.rs
index 88e6b4c..1a1c19d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -35,18 +35,6 @@ use crate::filter::OwnerFilter;
use crate::filter::TimeFilter;
use crate::regex_helper::{pattern_has_uppercase_char, pattern_matches_strings_with_leading_dot};
-// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481
-// FIXME: re-enable jemalloc on macOS, see comment in Cargo.toml file for more infos
-#[cfg(all(
- not(windows),
- not(target_os = "android"),
- not(target_os = "macos"),
- not(target_os = "freebsd"),
- not(target_os = "openbsd"),
- not(all(target_env = "musl", target_pointer_width = "32")),
- not(target_arch = "riscv64"),
- feature = "use-jemalloc"
-))]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;