feat: migrate to tcmalloc

This commit is contained in:
Ludo Galabru
2024-01-18 09:10:48 -05:00
parent eca79f0e92
commit 7d048a3128
4 changed files with 63 additions and 3 deletions

57
Cargo.lock generated
View File

@@ -259,6 +259,29 @@ dependencies = [
"syn 2.0.41",
]
[[package]]
name = "bindgen"
version = "0.68.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078"
dependencies = [
"bitflags 2.4.1",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"prettyplease",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"syn 2.0.41",
"which",
]
[[package]]
name = "bitcoin"
version = "0.31.0"
@@ -1504,6 +1527,15 @@ dependencies = [
"hmac 0.8.1",
]
[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "http"
version = "0.2.11"
@@ -1795,7 +1827,7 @@ version = "0.11.0+8.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e"
dependencies = [
"bindgen",
"bindgen 0.65.1",
"bzip2-sys",
"cc",
"glob",
@@ -2280,6 +2312,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"tcmalloc2",
"toml 0.5.11",
]
@@ -3804,6 +3837,16 @@ version = "0.12.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
[[package]]
name = "tcmalloc2"
version = "0.1.2+2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5af9a4fe36969c3ae05e5ba829b191d671fc1bb6569e0245f0b57970da9f04a5"
dependencies = [
"bindgen 0.68.1",
"num_cpus",
]
[[package]]
name = "tempfile"
version = "3.8.1"
@@ -4402,6 +4445,18 @@ version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix",
]
[[package]]
name = "winapi"
version = "0.3.9"

View File

@@ -24,6 +24,7 @@ clap = { version = "3.2.23", features = ["derive"], optional = true }
clap_generate = { version = "3.0.3", optional = true }
toml = { version = "0.5.6", features = ["preserve_order"], optional = true }
ctrlc = { version = "3.2.2", optional = true }
tcmalloc2 = "0.1.2+2.13"
[features]
default = ["cli"]

View File

@@ -7,6 +7,10 @@ extern crate hiro_system_kit;
pub mod cli;
pub mod config;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: tcmalloc2::TcMalloc = tcmalloc2::TcMalloc;
fn main() {
cli::main();
}

View File

@@ -2,7 +2,7 @@ FROM rust:bullseye as build
WORKDIR /src
RUN apt-get update && apt-get install -y ca-certificates pkg-config libssl-dev libclang-11-dev curl gnupg
RUN apt-get update && apt-get install -y ca-certificates pkg-config libssl-dev libclang-11-dev libunwind-dev libunwind8 curl gnupg
RUN rustup update 1.72.0 && rustup default 1.72.0
@@ -50,7 +50,7 @@ FROM debian:bullseye-slim
WORKDIR /ordhook-sdk-js
RUN apt-get update && apt-get install -y ca-certificates libssl-dev
RUN apt-get update && apt-get install -y ca-certificates libssl-dev libclang-11-dev libunwind-dev libunwind8 sqlite3
# COPY --from=build /out/*.node /ordhook-sdk-js/