Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(perf): switch global allocator to mimalloc #14691

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminds me that since Cargo is no longer a workspace member in rust-lang/rust, we may have missed some optimization they've done in the past. We may also want to check what we should pick up again in Cargo's [profile].

x-hgg-x marked this conversation as resolved.
Show resolved Hide resolved
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