Skip to content

Commit

Permalink
fix(perf): switch global allocator to jemalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
x-hgg-x committed Oct 22, 2024
1 parent 42f4143 commit 0ce2c6e
Show file tree
Hide file tree
Showing 3 changed files with 27 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.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ libc = "0.2.155"
libgit2-sys = "0.17.0"
libloading = "0.8.5"
memchr = "2.7.4"
mimalloc = "0.1.43"
miow = "0.6.0"
opener = "0.7.1"
openssl = "=0.10.57" # See rust-lang/cargo#13546 and openssl/openssl#23376 for pinning
Expand Down Expand Up @@ -181,6 +182,7 @@ jobserver.workspace = true
lazycell.workspace = true
libgit2-sys.workspace = true
memchr.workspace = true
mimalloc = { workspace = true, optional = true }
opener.workspace = true
os_info.workspace = true
pasetors.workspace = true
Expand Down Expand Up @@ -260,6 +262,7 @@ test = false
doc = false

[features]
mimalloc = ["dep:mimalloc"]
vendored-openssl = ["openssl/vendored"]
vendored-libgit2 = ["libgit2-sys/vendored"]
# This is primarily used by rust-lang/rust distributing cargo the executable.
Expand Down
4 changes: 4 additions & 0 deletions src/bin/cargo/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#![allow(clippy::self_named_module_files)] // false positive in `commands/build.rs`

#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

use cargo::core::features;
use cargo::core::shell::Shell;
use cargo::util::network::http::http_handle;
Expand Down

0 comments on commit 0ce2c6e

Please sign in to comment.