Skip to content

Commit 7c4245f

Browse files
danieljharveyhasura-bot
authored andcommitted
Use mimalloc (#961)
<!-- The PR description should answer 2 important questions: --> ### What We started using `mimalloc` allocator in MBS a while ago with good results, let's use it here too. Once `v3-engine-multitenant` is merged we should use it there too. ### How Import crate, switch it on in engine binary and in benchmarks. <img width="845" alt="Screenshot 2024-08-13 at 10 10 49" src="https://github.com/user-attachments/assets/dc872668-1633-468a-86d3-51fca5be68bf"> V3_GIT_ORIGIN_REV_ID: ebad91bb57964477d0f227e341c7bd12d54f0f68
1 parent 547ce02 commit 7c4245f

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

v3/Cargo.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v3/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jsonptr = "0.4"
8989
jsonwebkey = "0.3"
9090
jsonwebtoken = "8"
9191
lexical-core = "0.8"
92+
mimalloc = "0.1"
9293
mockito = { version = "~1.4", default-features = false } # v1.5+ depends on http v1
9394
nonempty = "0.10"
9495
openssl = "0.10"

v3/crates/engine/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ axum = { workspace = true }
4040
base64 = { workspace = true }
4141
clap = { workspace = true, features = ["derive", "env"] }
4242
json_value_merge = { workspace = true }
43+
mimalloc = { workspace = true }
4344
nonempty = { workspace = true }
4445
reqwest = { workspace = true, features = ["json", "multipart"] }
4546
schemars = { workspace = true, features = ["smol_str"] }

v3/crates/engine/benches/execute.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ use std::path::Path;
1919

2020
use lang_graphql as gql;
2121

22+
// match allocator used by engine binary
23+
#[global_allocator]
24+
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
25+
2226
pub fn merge_with_common_metadata(
2327
common_metadata_path: &Path,
2428
metadata_path_string: &Path,

v3/crates/engine/bin/engine/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ use tracing_util::{
4343

4444
mod cors;
4545

46+
#[global_allocator]
47+
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
48+
4649
const DEFAULT_PORT: u16 = 3000;
4750

4851
const MB: usize = 1_048_576;

0 commit comments

Comments
 (0)