diff options
author | Ivan Kozik <[email protected]> | 2020-07-14 01:12:49 +0100 |
---|---|---|
committer | Ivan Kozik <[email protected]> | 2020-07-14 21:57:51 +0100 |
commit | 6710856c1098f71168c47451af53bac9a33b49dd (patch) | |
tree | 46a514e5fd86dd33f16f9abca6ab14f5063c9696 /crates | |
parent | 46d4487b8900324fc6a523c8b6ebe036d28fd0fb (diff) |
Add opt-in mimalloc feature
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_prof/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_prof/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_prof/Cargo.toml b/crates/ra_prof/Cargo.toml index eabfcebb0..3cd8481ea 100644 --- a/crates/ra_prof/Cargo.toml +++ b/crates/ra_prof/Cargo.toml | |||
@@ -12,6 +12,7 @@ doctest = false | |||
12 | ra_arena = { path = "../ra_arena" } | 12 | ra_arena = { path = "../ra_arena" } |
13 | once_cell = "1.3.1" | 13 | once_cell = "1.3.1" |
14 | backtrace = { version = "0.3.44", optional = true } | 14 | backtrace = { version = "0.3.44", optional = true } |
15 | mimalloc = { version = "0.1.19", default-features = false, optional = true } | ||
15 | 16 | ||
16 | [target.'cfg(not(target_env = "msvc"))'.dependencies] | 17 | [target.'cfg(not(target_env = "msvc"))'.dependencies] |
17 | jemallocator = { version = "0.3.2", optional = true } | 18 | jemallocator = { version = "0.3.2", optional = true } |
@@ -24,4 +25,5 @@ cpu_profiler = [] | |||
24 | # Uncomment to enable for the whole crate graph | 25 | # Uncomment to enable for the whole crate graph |
25 | # default = [ "backtrace" ] | 26 | # default = [ "backtrace" ] |
26 | # default = [ "jemalloc" ] | 27 | # default = [ "jemalloc" ] |
28 | # default = [ "mimalloc" ] | ||
27 | # default = [ "cpu_profiler" ] | 29 | # default = [ "cpu_profiler" ] |
diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index 7163a8424..b54531b4e 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs | |||
@@ -19,6 +19,10 @@ pub use crate::{ | |||
19 | #[global_allocator] | 19 | #[global_allocator] |
20 | static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; | 20 | static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; |
21 | 21 | ||
22 | #[cfg(all(feature = "mimalloc"))] | ||
23 | #[global_allocator] | ||
24 | static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; | ||
25 | |||
22 | /// Prints backtrace to stderr, useful for debugging. | 26 | /// Prints backtrace to stderr, useful for debugging. |
23 | #[cfg(feature = "backtrace")] | 27 | #[cfg(feature = "backtrace")] |
24 | pub fn print_backtrace() { | 28 | pub fn print_backtrace() { |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index c02f72517..5074740cc 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -65,3 +65,4 @@ tt = { path = "../ra_tt", package = "ra_tt" } | |||
65 | 65 | ||
66 | [features] | 66 | [features] |
67 | jemalloc = [ "ra_prof/jemalloc" ] | 67 | jemalloc = [ "ra_prof/jemalloc" ] |
68 | mimalloc = [ "ra_prof/mimalloc" ] | ||