Merge pull request #206 from passcod/mimalloc-on-windows

Add mimalloc on feature flag
This commit is contained in:
Félix Saparelli 2022-07-07 00:14:31 +12:00 committed by GitHub
commit 3c06c45792
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

19
Cargo.lock generated
View file

@ -146,6 +146,7 @@ dependencies = [
"home", "home",
"log", "log",
"miette", "miette",
"mimalloc",
"once_cell", "once_cell",
"reqwest", "reqwest",
"scopeguard", "scopeguard",
@ -778,6 +779,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "libmimalloc-sys"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11ca136052550448f55df7898c6dbe651c6b574fe38a0d9ea687a9f8088a2e2c"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "libz-ng-sys" name = "libz-ng-sys"
version = "1.1.8" version = "1.1.8"
@ -850,6 +860,15 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "mimalloc"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f64ad83c969af2e732e907564deb0d0ed393cec4af80776f77dd77a1a427698"
dependencies = [
"libmimalloc-sys",
]
[[package]] [[package]]
name = "mime" name = "mime"
version = "0.3.16" version = "0.3.16"

View file

@ -31,6 +31,7 @@ futures-util = { version = "0.3.21", default-features = false }
home = "0.5.3" home = "0.5.3"
log = "0.4.14" log = "0.4.14"
miette = { version = "5.1.0", features = ["fancy-no-backtrace"] } miette = { version = "5.1.0", features = ["fancy-no-backtrace"] }
mimalloc = { version = "0.1.29", default-features = false, optional = true }
once_cell = "1.12.0" once_cell = "1.12.0"
reqwest = { version = "0.11.11", features = ["rustls-tls", "stream"], default-features = false } reqwest = { version = "0.11.11", features = ["rustls-tls", "stream"], default-features = false }
scopeguard = "1.1.0" scopeguard = "1.1.0"
@ -68,6 +69,10 @@ zstd = { version = "0.10.0", features = ["bindgen", "zstdmt"], default-features
[target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies] [target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies]
guess_host_triple = "0.1.3" guess_host_triple = "0.1.3"
[features]
default = []
mimalloc = ["dep:mimalloc"]
[dev-dependencies] [dev-dependencies]
env_logger = "0.9.0" env_logger = "0.9.0"

View file

@ -25,6 +25,10 @@ use cargo_binstall::{
*, *,
}; };
#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap(version, about = "Install a Rust binary... from binaries!")] #[clap(version, about = "Install a Rust binary... from binaries!")]
struct Options { struct Options {