Skip to content

Commit

Permalink
Use mimalloc in musl builds
Browse files Browse the repository at this point in the history
  • Loading branch information
krant committed Mar 28, 2024
1 parent ccc9e71 commit adf053a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
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.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ walkdir = "2.3"
# Unpacking of VSIX "packages"
zip = { version = "0.6", default-features = false, features = ["deflate"] }

[target.'cfg(target_env = "musl")'.dependencies]
# Faster allocator for musl builds
mimalloc = { version = "*", default-features = false }

[dev-dependencies]
insta = "1.12"

Expand Down
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#[cfg(target_env = "musl")]
use mimalloc::MiMalloc;
#[cfg(target_env = "musl")]
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;

use anyhow::{Context as _, Error};
use camino::Utf8PathBuf as PathBuf;
use clap::builder::{PossibleValuesParser, TypedValueParser as _};
Expand Down

0 comments on commit adf053a

Please sign in to comment.