Use mimalloc when targeting musl

This commit is contained in:
2024-09-29 11:52:04 -06:00
parent c7b85518ab
commit cc1bc44e69
3 changed files with 29 additions and 0 deletions

View File

@@ -2,6 +2,12 @@ mod argp_version;
mod cmd;
mod util;
// 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, ffi::OsStr, fmt::Display, path::PathBuf, str::FromStr};
use anyhow::{Error, Result};