Skip to content

Commit

Permalink
Use mimalloc when targeting musl
Browse files Browse the repository at this point in the history
Also removes the armv7 linux build.
If you used it, let me know!
  • Loading branch information
encounter committed Sep 29, 2024
1 parent 312dd6f commit 5ad514d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ jobs:
name: linux-aarch64
build: zigbuild
features: nightly
- platform: ubuntu-latest
target: armv7-unknown-linux-musleabi
name: linux-armv7l
build: zigbuild
features: default
- platform: windows-latest
target: i686-pc-windows-msvc
name: windows-x86
Expand Down
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions nodtool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ xxhash-rust = { version = "0.8", features = ["xxh64"] }
zerocopy = { version = "0.7", features = ["alloc", "derive"] }
zstd = "0.13"

[target.'cfg(target_env = "musl")'.dependencies]
mimalloc = "0.1"

[build-dependencies]
hex = { version = "0.4", features = ["serde"] }
quick-xml = { version = "0.36", features = ["serialize"] }
Expand Down
6 changes: 6 additions & 0 deletions nodtool/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
mod argp_version;

// musl's allocator is very slow, so use mimalloc when targeting musl.
// Otherwise, use the system allocator to avoid extra code size.
#[cfg(target_env = "musl")]
#[global_allocator]
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;

use std::{env, error::Error, ffi::OsStr, fmt, path::PathBuf, str::FromStr};

use argp::{FromArgValue, FromArgs};
Expand Down

0 comments on commit 5ad514d

Please sign in to comment.