From 8dead81cef1d3560091fb53740a97b130d4421c6 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 4 Oct 2023 21:28:47 +0200 Subject: [PATCH] 50% performance boost from jemalloc! --- Cargo.lock | 23 ++++++++++++++++++++++- syndicate-server/Cargo.toml | 2 ++ syndicate-server/src/main.rs | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 31851c6..e91a812 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1973,6 +1973,7 @@ dependencies = [ "structopt", "syndicate", "syndicate-macros", + "tikv-jemallocator", "tokio", "tokio-tungstenite", "tokio-util", @@ -1984,7 +1985,7 @@ dependencies = [ [[package]] name = "syndicate-tools" -version = "0.6.0" +version = "0.7.0" dependencies = [ "clap 4.4.5", "clap_complete", @@ -2046,6 +2047,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 = "tinytemplate" version = "1.2.1" diff --git a/syndicate-server/Cargo.toml b/syndicate-server/Cargo.toml index dc60520..d003644 100644 --- a/syndicate-server/Cargo.toml +++ b/syndicate-server/Cargo.toml @@ -26,6 +26,8 @@ noise-rust-crypto = "0.5" notify = "4.0" structopt = "0.3" +tikv-jemallocator = "0.5.0" + tungstenite = "0.13" tokio-tungstenite = "0.14" diff --git a/syndicate-server/src/main.rs b/syndicate-server/src/main.rs index 9d561f9..6382a89 100644 --- a/syndicate-server/src/main.rs +++ b/syndicate-server/src/main.rs @@ -26,6 +26,9 @@ mod protocol; mod script; mod services; +#[global_allocator] +static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + mod schemas { include!(concat!(env!("OUT_DIR"), "/src/schemas/mod.rs")); }