perf: use jemalloc on macOS, use system allocator on other platforms

This commit is contained in:
monosans
2026-07-13 01:59:58 +03:00
parent e476ca2cae
commit b43b35e2e6
5 changed files with 26 additions and 17 deletions
+16
View File
@@ -60,6 +60,22 @@ jobs:
allocator: jemalloc
- platform: windows-11-arm
allocator: jemalloc
- platform: windows-2025
allocator: mimalloc_v2_no_thp
- platform: windows-2025
allocator: mimalloc_v3_no_thp
- platform: windows-11-arm
allocator: mimalloc_v2_no_thp
- platform: windows-11-arm
allocator: mimalloc_v3_no_thp
- platform: macos-26
allocator: mimalloc_v2_no_thp
- platform: macos-26
allocator: mimalloc_v3_no_thp
- platform: macos-26-intel
allocator: mimalloc_v2_no_thp
- platform: macos-26-intel
allocator: mimalloc_v3_no_thp
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
+5 -7
View File
@@ -59,7 +59,7 @@ smallvec = { version = "=1.15.2", features = [
"union",
], optional = true }
strum = { version = "=0.28.0", features = ["derive"], optional = true }
tikv-jemallocator = { version = "=0.7.0", features = [
tikv-jemallocator = { version = "=0.7.0", default-features = false, features = [
"override_allocator_on_supported_platforms",
], optional = true }
tokio = { version = "=1.52.3", features = ["fs", "parking_lot", "signal"] }
@@ -80,17 +80,15 @@ tui-logger = { version = "=0.18.3", features = [
], optional = true }
url = "=2.5.8"
[target.'cfg(all(any(target_arch = "aarch64", target_arch = "x86_64"), any(all(target_os = "linux", any(target_env = "musl", target_env = "gnu")), target_os = "macos", all(target_os = "windows", target_env = "msvc"))))'.dependencies]
mimalloc-auto = { package = "mimalloc", version = "=0.1.52", features = [
"no_thp",
"override",
"v2"
[target.'cfg(target_os = "macos")'.dependencies]
tikv-jemallocator-auto = { package = "tikv-jemallocator", version = "=0.7.0", default-features = false, features = [
"override_allocator_on_supported_platforms",
], optional = true }
[features]
default = ["auto-allocator"]
__mimalloc = ["dep:mimalloc"]
auto-allocator = ["dep:mimalloc-auto"]
auto-allocator = ["dep:tikv-jemallocator-auto"]
dhat = ["dep:dhat"]
jemalloc = ["dep:tikv-jemallocator"]
mimalloc_v2 = ["__mimalloc", "mimalloc/v2"]
Submodule
+1
Submodule jemallocator added at 0e9129157d
Submodule
+1
Submodule mimalloc_rust added at a35cc759c0
+3 -10
View File
@@ -69,17 +69,10 @@ use tracing_subscriber::{
layer::SubscriberExt as _, util::SubscriberInitExt as _,
};
#[cfg(all(
feature = "auto-allocator",
any(target_arch = "aarch64", target_arch = "x86_64"),
any(
all(target_os = "linux", any(target_env = "musl", target_env = "gnu")),
target_os = "macos",
all(target_os = "windows", target_env = "msvc")
),
))]
#[cfg(all(feature = "auto-allocator", target_os = "macos"))]
#[global_allocator]
static GLOBAL: mimalloc_auto::MiMalloc = mimalloc_auto::MiMalloc;
static GLOBAL: tikv_jemallocator_auto::Jemalloc =
tikv_jemallocator_auto::Jemalloc;
#[cfg(feature = "dhat")]
#[global_allocator]