Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

perf(rome_cli): replace global allocator with jemalloc #3237

Merged
merged 2 commits into from
Sep 21, 2022
Merged
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
29 changes: 29 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 crates/rome_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ tokio = { version = "1.15.0", features = ["process"] }
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"

[target.'cfg(not(windows))'.dependencies]
tikv-jemallocator = "0.5.0"

[dev-dependencies]
insta = "1.18.2"
tokio = { version = "1.15.0", features = ["io-util"] }
4 changes: 4 additions & 0 deletions crates/rome_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ use tokio::runtime::Runtime;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[cfg(not(target_os = "windows"))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

fn main() -> Result<(), Termination> {
setup_panic_handler();

Expand Down
3 changes: 3 additions & 0 deletions xtask/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ humansize = {version = "1.1.1", optional = true }
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = "0.1.29"

[target.'cfg(not(windows))'.dependencies]
tikv-jemallocator = "0.5.0"

[features]
dhat-heap = ["dhat", "humansize"]
4 changes: 4 additions & 0 deletions xtask/bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ static ALLOCATOR: dhat::Alloc = dhat::Alloc;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[cfg(all(not(target_os = "windows"), not(feature = "dhat-heap")))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

fn main() -> Result<(), pico_args::Error> {
#[cfg(feature = "dhat-heap")]
let _profiler = dhat::Profiler::new_heap();
Expand Down