From ffe3b8ffec9747b28926c565a2ff6d57909b19d9 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Mon, 18 Sep 2023 01:17:42 -0400 Subject: [PATCH] use jemalloc --- packages/backend/native-utils/Cargo.lock | 21 +++++++++++++++++++ .../native-utils/scylla-migration/Cargo.toml | 3 +++ .../native-utils/scylla-migration/src/main.rs | 7 +++++++ 3 files changed, 31 insertions(+) diff --git a/packages/backend/native-utils/Cargo.lock b/packages/backend/native-utils/Cargo.lock index f4d5ca4dfc..f3a3a99e20 100644 --- a/packages/backend/native-utils/Cargo.lock +++ b/packages/backend/native-utils/Cargo.lock @@ -2466,6 +2466,7 @@ dependencies = [ "serde", "serde_yaml", "thiserror", + "tikv-jemallocator", "tokio", "urlencoding", ] @@ -3251,6 +3252,26 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tikv-jemalloc-sys" +version = "0.5.4+5.3.0-patched" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + [[package]] name = "time" version = "0.1.45" diff --git a/packages/backend/native-utils/scylla-migration/Cargo.toml b/packages/backend/native-utils/scylla-migration/Cargo.toml index eaa0b74be3..85a11474c5 100644 --- a/packages/backend/native-utils/scylla-migration/Cargo.toml +++ b/packages/backend/native-utils/scylla-migration/Cargo.toml @@ -18,3 +18,6 @@ serde_yaml = "0.9.22" thiserror = "1.0.43" tokio = { version = "1.29.1", features = ["full"] } urlencoding = "2.1.3" + +[target.'cfg(not(target_env = "msvc"))'.dependencies] +tikv-jemallocator = "0.5.4" diff --git a/packages/backend/native-utils/scylla-migration/src/main.rs b/packages/backend/native-utils/scylla-migration/src/main.rs index 9b21f0515c..d6e6f3dfb8 100644 --- a/packages/backend/native-utils/scylla-migration/src/main.rs +++ b/packages/backend/native-utils/scylla-migration/src/main.rs @@ -1,3 +1,10 @@ +#[cfg(not(target_env = "msvc"))] +use tikv_jemallocator::Jemalloc; + +#[cfg(not(target_env = "msvc"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; + use scylla_migration::{cli::run_cli, error::Error}; #[tokio::main]