aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-15 10:43:08 +0100
committerGitHub <[email protected]>2020-07-15 10:43:08 +0100
commitb8b41c5f41a0cf8bf9c15a3bbcdd8d626eb41772 (patch)
tree5f68995303745ccfe6a9fb9a95255c09fdc5d9b5
parent77425c21c797bab5ae66c418751d689691229651 (diff)
parent6710856c1098f71168c47451af53bac9a33b49dd (diff)
Merge #5354
5354: Add opt-in mimalloc feature r=matklad a=ivan This adds a `mimalloc` feature to use [mimalloc](https://github.com/microsoft/mimalloc) via [mimalloc_rust](https://github.com/purpleprotocol/mimalloc_rust), and a corresponding `cargo xtask install --server --mimalloc`. In my tests on Linux, mimalloc seems to run consistently faster than jemalloc and uses only slightly more memory in `analysis-stats` on chalk. Also, builds with mimalloc produce a binary 3MB smaller than builds with jemalloc. A summary of `env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/` runs on NixOS master on an Intel 4790K in VMware Workstation: <table> <tr> <td></td><td>self-reported time</td><td>elapsed time</td><td>max RSS</td> </tr> <tr><td>glibc 2.30 run 1</td><td>225.1 sec</td><td>3:46.91</td><td>1075208</td></tr> <tr><td>glibc 2.30 run 2</td><td>228.4 sec</td><td>3:50.13</td><td>1074996</td></tr> <tr><td>jemalloc run 1</td><td>201.8 sec</td><td>3:23.03</td><td>1055960</td></tr> <tr><td>jemalloc run 2</td><td>199.2 sec</td><td>3:20.41</td><td>1065040</td></tr> <tr><td>mimalloc run 1</td><td>188.6 sec</td><td>3:09.77</td><td>1105584</td></tr> <tr><td>mimalloc run 2</td><td>185.0 sec</td><td>3:06.23</td><td>1108132</td></tr> <tr><td>mimalloc + lto run 1</td><td>160.7 sec</td><td>2:41.80</td><td>1106076</td></tr> <tr><td>mimalloc + lto run 2</td><td>162.2 sec</td><td>2:43.31</td><td>1104268</td></tr> </tr> </table> I included an `lto = true; codegen-units = 1` run out of curiosity, this PR doesn't enable it. <details> <summary>analysis-stats benchmark runs</summary> ## default ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 333.880345ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 10.176299461s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 214.968806927s, 0b allocated 0b resident Total: 225.145114417s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 225.34 System time (seconds): 1.49 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:46.91 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1075208 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 6 Minor (reclaiming a frame) page faults: 294711 Voluntary context switches: 365 Involuntary context switches: 3273 Swaps: 0 File system inputs: 2904 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 332.711598ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.895020518s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 218.5001697s, 0b allocated 0b resident Total: 228.39519833s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 228.26 System time (seconds): 1.75 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:50.13 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1074996 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 9 Minor (reclaiming a frame) page faults: 294748 Voluntary context switches: 330 Involuntary context switches: 1561 Swaps: 0 File system inputs: 12608 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` ## jemalloc ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.11s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 356.090374ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 10.176550183s, 439mb allocated 465mb resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 191.607201827s, 993mb allocated 1036mb resident Total: 201.783937913s, 993mb allocated 1036mb resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 201.07 System time (seconds): 1.89 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:23.03 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1055960 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 357755 Voluntary context switches: 240 Involuntary context switches: 1889 Swaps: 0 File system inputs: 256 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 317.917622ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.902142185s, 439mb allocated 463mb resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 189.295317017s, 993mb allocated 1046mb resident Total: 199.197555943s, 993mb allocated 1046mb resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 198.64 System time (seconds): 1.67 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:20.41 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1065040 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 369013 Voluntary context switches: 243 Involuntary context switches: 2835 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` ## mimalloc ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.12s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 332.116806ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.796643695s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 178.82132362s, 0b allocated 0b resident Total: 188.617975605s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 187.70 System time (seconds): 1.97 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:09.77 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1105584 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 296481 Voluntary context switches: 222 Involuntary context switches: 1868 Swaps: 0 File system inputs: 256 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.13s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 320.046776ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.287690124s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 175.710939697s, 0b allocated 0b resident Total: 184.998640033s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 184.38 System time (seconds): 1.81 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:06.23 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1108132 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 297055 Voluntary context switches: 374 Involuntary context switches: 2374 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` ## mimalloc + lto ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.11s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 369.600196ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 7.572726834s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 153.090899101s, 0b allocated 0b resident Total: 160.663635235s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 160.01 System time (seconds): 1.70 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 2:41.80 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1106076 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 1 Minor (reclaiming a frame) page faults: 296610 Voluntary context switches: 209 Involuntary context switches: 2798 Swaps: 0 File system inputs: 8 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 334.630658ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 7.71699197s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 154.50351318s, 0b allocated 0b resident Total: 162.220513775s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 161.52 System time (seconds): 1.74 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 2:43.31 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1104268 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 296183 Voluntary context switches: 200 Involuntary context switches: 1666 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` </details> Co-authored-by: Ivan Kozik <[email protected]>
-rw-r--r--Cargo.lock28
-rw-r--r--crates/ra_prof/Cargo.toml2
-rw-r--r--crates/ra_prof/src/lib.rs4
-rw-r--r--crates/rust-analyzer/Cargo.toml1
-rw-r--r--xtask/src/install.rs16
-rw-r--r--xtask/src/main.rs15
6 files changed, 60 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 11eb9a823..6cc44e0da 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -215,6 +215,15 @@ dependencies = [
215] 215]
216 216
217[[package]] 217[[package]]
218name = "cmake"
219version = "0.1.44"
220source = "registry+https://github.com/rust-lang/crates.io-index"
221checksum = "0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb"
222dependencies = [
223 "cc",
224]
225
226[[package]]
218name = "console" 227name = "console"
219version = "0.11.3" 228version = "0.11.3"
220source = "registry+https://github.com/rust-lang/crates.io-index" 229source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -675,6 +684,15 @@ dependencies = [
675] 684]
676 685
677[[package]] 686[[package]]
687name = "libmimalloc-sys"
688version = "0.1.15"
689source = "registry+https://github.com/rust-lang/crates.io-index"
690checksum = "a27252ec1d0c4e0dd6142cbc572da50b363ab56fc334f7aa8fadf295b2e24e74"
691dependencies = [
692 "cmake",
693]
694
695[[package]]
678name = "linked-hash-map" 696name = "linked-hash-map"
679version = "0.5.3" 697version = "0.5.3"
680source = "registry+https://github.com/rust-lang/crates.io-index" 698source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -771,6 +789,15 @@ dependencies = [
771] 789]
772 790
773[[package]] 791[[package]]
792name = "mimalloc"
793version = "0.1.19"
794source = "registry+https://github.com/rust-lang/crates.io-index"
795checksum = "6c52de2069999f01bd26436564dbe7de3a87898feeb7a0d0ff9eb20a05bb7ca0"
796dependencies = [
797 "libmimalloc-sys",
798]
799
800[[package]]
774name = "miniz_oxide" 801name = "miniz_oxide"
775version = "0.4.0" 802version = "0.4.0"
776source = "registry+https://github.com/rust-lang/crates.io-index" 803source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1248,6 +1275,7 @@ dependencies = [
1248 "backtrace", 1275 "backtrace",
1249 "jemalloc-ctl", 1276 "jemalloc-ctl",
1250 "jemallocator", 1277 "jemallocator",
1278 "mimalloc",
1251 "once_cell", 1279 "once_cell",
1252 "ra_arena", 1280 "ra_arena",
1253] 1281]
diff --git a/crates/ra_prof/Cargo.toml b/crates/ra_prof/Cargo.toml
index 69ac51c9e..b3d52985a 100644
--- a/crates/ra_prof/Cargo.toml
+++ b/crates/ra_prof/Cargo.toml
@@ -13,6 +13,7 @@ doctest = false
13ra_arena = { path = "../ra_arena" } 13ra_arena = { path = "../ra_arena" }
14once_cell = "1.3.1" 14once_cell = "1.3.1"
15backtrace = { version = "0.3.44", optional = true } 15backtrace = { version = "0.3.44", optional = true }
16mimalloc = { version = "0.1.19", default-features = false, optional = true }
16 17
17[target.'cfg(not(target_env = "msvc"))'.dependencies] 18[target.'cfg(not(target_env = "msvc"))'.dependencies]
18jemallocator = { version = "0.3.2", optional = true } 19jemallocator = { version = "0.3.2", optional = true }
@@ -25,4 +26,5 @@ cpu_profiler = []
25# Uncomment to enable for the whole crate graph 26# Uncomment to enable for the whole crate graph
26# default = [ "backtrace" ] 27# default = [ "backtrace" ]
27# default = [ "jemalloc" ] 28# default = [ "jemalloc" ]
29# default = [ "mimalloc" ]
28# default = [ "cpu_profiler" ] 30# 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]
20static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; 20static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
21 21
22#[cfg(all(feature = "mimalloc"))]
23#[global_allocator]
24static 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")]
24pub fn print_backtrace() { 28pub fn print_backtrace() {
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 370b13090..57724bcbc 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -66,3 +66,4 @@ tt = { path = "../ra_tt", package = "ra_tt" }
66 66
67[features] 67[features]
68jemalloc = [ "ra_prof/jemalloc" ] 68jemalloc = [ "ra_prof/jemalloc" ]
69mimalloc = [ "ra_prof/mimalloc" ]
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index 9ba77a3aa..a0dc0c9c2 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -19,7 +19,13 @@ pub enum ClientOpt {
19} 19}
20 20
21pub struct ServerOpt { 21pub struct ServerOpt {
22 pub jemalloc: bool, 22 pub malloc: Malloc,
23}
24
25pub enum Malloc {
26 System,
27 Jemalloc,
28 Mimalloc,
23} 29}
24 30
25impl InstallCmd { 31impl InstallCmd {
@@ -130,8 +136,12 @@ fn install_server(opts: ServerOpt) -> Result<()> {
130 ) 136 )
131 } 137 }
132 138
133 let jemalloc = if opts.jemalloc { "--features jemalloc" } else { "" }; 139 let malloc_feature = match opts.malloc {
134 let res = run!("cargo install --path crates/rust-analyzer --locked --force {}", jemalloc); 140 Malloc::System => "",
141 Malloc::Jemalloc => "--features jemalloc",
142 Malloc::Mimalloc => "--features mimalloc",
143 };
144 let res = run!("cargo install --path crates/rust-analyzer --locked --force {}", malloc_feature);
135 145
136 if res.is_err() && old_rust { 146 if res.is_err() && old_rust {
137 eprintln!( 147 eprintln!(
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index f447613d4..399ff7204 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -14,7 +14,7 @@ use pico_args::Arguments;
14use xtask::{ 14use xtask::{
15 codegen::{self, Mode}, 15 codegen::{self, Mode},
16 dist::run_dist, 16 dist::run_dist,
17 install::{ClientOpt, InstallCmd, ServerOpt}, 17 install::{ClientOpt, InstallCmd, Malloc, ServerOpt},
18 not_bash::pushd, 18 not_bash::pushd,
19 pre_commit, project_root, 19 pre_commit, project_root,
20 release::{PromoteCmd, ReleaseCmd}, 20 release::{PromoteCmd, ReleaseCmd},
@@ -46,6 +46,7 @@ FLAGS:
46 --client-code Install only VS Code plugin 46 --client-code Install only VS Code plugin
47 --server Install only the language server 47 --server Install only the language server
48 --jemalloc Use jemalloc for server 48 --jemalloc Use jemalloc for server
49 --mimalloc Use mimalloc for server
49 -h, --help Prints help information 50 -h, --help Prints help information
50 " 51 "
51 ); 52 );
@@ -61,13 +62,21 @@ FLAGS:
61 return Ok(()); 62 return Ok(());
62 } 63 }
63 64
64 let jemalloc = args.contains("--jemalloc"); 65 let malloc = match (args.contains("--jemalloc"), args.contains("--mimalloc")) {
66 (false, false) => Malloc::System,
67 (true, false) => Malloc::Jemalloc,
68 (false, true) => Malloc::Mimalloc,
69 (true, true) => {
70 eprintln!("error: Cannot use both `--jemalloc` and `--mimalloc`");
71 return Ok(());
72 }
73 };
65 74
66 args.finish()?; 75 args.finish()?;
67 76
68 InstallCmd { 77 InstallCmd {
69 client: if server { None } else { Some(ClientOpt::VsCode) }, 78 client: if server { None } else { Some(ClientOpt::VsCode) },
70 server: if client_code { None } else { Some(ServerOpt { jemalloc }) }, 79 server: if client_code { None } else { Some(ServerOpt { malloc }) },
71 } 80 }
72 .run() 81 .run()
73 } 82 }