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

Commit

Permalink
perf(rome_cli): replace global allocator with jemalloc (#3237)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored Sep 21, 2022
1 parent c7aebe3 commit 806de56
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
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

0 comments on commit 806de56

Please sign in to comment.