From 2aac53032750f4cc7a6d5904633f2606afc4607b Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Sat, 11 Sep 2021 19:02:15 -0700 Subject: [PATCH] Change the default roc allocator to mimalloc --- Cargo.lock | 19 +++++++++++++++++++ cli/Cargo.toml | 1 + cli/src/main.rs | 3 +++ 3 files changed, 23 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 272d75e8ea..5a26a1d7d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2026,6 +2026,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "libmimalloc-sys" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1b8479c593dba88c2741fc50b92e13dbabbbe0bd504d979f244ccc1a5b1c01" +dependencies = [ + "cc", +] + [[package]] name = "linked-hash-map" version = "0.5.4" @@ -2170,6 +2179,15 @@ dependencies = [ "objc", ] +[[package]] +name = "mimalloc" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb74897ce508e6c49156fd1476fc5922cbc6e75183c65e399c765a09122e5130" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "minimal-lexical" version = "0.1.3" @@ -3432,6 +3450,7 @@ dependencies = [ "libc", "libloading 0.6.7", "maplit", + "mimalloc", "pretty_assertions 0.5.1", "quickcheck 0.8.5", "quickcheck_macros 0.8.0", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a98ab09045..0225a11916 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -67,6 +67,7 @@ im-rc = "14" # im and im-rc should always have the same version! bumpalo = { version = "3.2", features = ["collections"] } libc = "0.2" libloading = "0.6" +mimalloc = { version = "0.1.26", default-features = false } inkwell = { path = "../vendor/inkwell", optional = true } target-lexicon = "0.12.2" diff --git a/cli/src/main.rs b/cli/src/main.rs index cd9cac0752..5a699a3f57 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -6,6 +6,9 @@ use std::fs::{self, FileType}; use std::io; use std::path::{Path, PathBuf}; +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[cfg(feature = "llvm")] use roc_cli::build; use std::ffi::{OsStr, OsString};