Explorar el Código

chore: switch to mimalloc

LongYinan hace 4 años
padre
commit
892566e3be
Se han modificado 2 ficheros con 3 adiciones y 11 borrados
  1. 1 4
      Cargo.toml
  2. 2 7
      src/lib.rs

+ 1 - 4
Cargo.toml

@@ -13,10 +13,7 @@ crate-type = ["cdylib"]
 napi = "1"
 napi-derive = "1"
 
-[target.'cfg(all(unix, not(target_env = "musl"), not(target_arch = "aarch64"), not(target_arch = "arm")))'.dependencies]
-jemallocator = {version = "0.3", features = ["disable_initial_exec_tls"]}
-
-[target.'cfg(all(windows, target_arch = "x86_64"))'.dependencies]
+[target.'cfg(all(any(windows, unix), target_arch = "x86_64", not(target_env = "musl")))'.dependencies]
 mimalloc = {version = "0.1"}
 
 [build-dependencies]

+ 2 - 7
src/lib.rs

@@ -8,17 +8,12 @@ use std::convert::TryInto;
 use napi::{CallContext, Env, JsNumber, JsObject, Result, Task};
 
 #[cfg(all(
-  unix,
+  any(windows, unix),
+  target_arch = "x86_64",
   not(target_env = "musl"),
-  not(target_arch = "aarch64"),
-  not(target_arch = "arm"),
   not(debug_assertions)
 ))]
 #[global_allocator]
-static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
-
-#[cfg(all(windows, target_arch = "x86_64"))]
-#[global_allocator]
 static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
 
 struct AsyncTask(u32);