diff --git a/Cargo.lock b/Cargo.lock index af36ac8c60..0c82dd5395 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -68,6 +68,7 @@ dependencies = [ "chrono", "clap", "humantime", + "mimalloc", "model", "number", "observe", @@ -293,6 +294,7 @@ dependencies = [ "indexmap 2.2.6", "itertools 0.12.1", "maplit", + "mimalloc", "mockall 0.12.1", "model", "num", @@ -1785,6 +1787,7 @@ dependencies = [ "itertools 0.12.1", "lazy_static", "maplit", + "mimalloc", "mockall 0.12.1", "model", "num", @@ -2867,6 +2870,16 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libmimalloc-sys" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "libsqlite3-sys" version = "0.27.0" @@ -2964,6 +2977,15 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +[[package]] +name = "mimalloc" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.17" @@ -3379,6 +3401,7 @@ dependencies = [ "humantime", "hyper", "maplit", + "mimalloc", "mockall 0.12.1", "model", "multibase", @@ -3864,6 +3887,7 @@ dependencies = [ "gas-estimation", "humantime", "lazy_static", + "mimalloc", "model", "number", "observe", @@ -4601,6 +4625,7 @@ dependencies = [ "hex-literal", "hyper", "itertools 0.12.1", + "mimalloc", "model", "num", "observe", diff --git a/Cargo.toml b/Cargo.toml index 7e02f8dbf2..c3dd3d5a69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ clap = { version = "4.5.6", features = ["derive", "env"] } derivative = "2.2.0" derive_more = "0.99.17" ethcontract = { version = "0.25.7", default-features = false, features = ["aws-kms"] } +mimalloc = "0.1.43" ethcontract-generate = { version = "0.25.7", default-features = false } ethcontract-mock = { version = "0.25.7", default-features = false } ethereum-types = "0.14.1" diff --git a/crates/alerter/Cargo.toml b/crates/alerter/Cargo.toml index ca5cbbd13a..6b836c495c 100644 --- a/crates/alerter/Cargo.toml +++ b/crates/alerter/Cargo.toml @@ -11,6 +11,7 @@ chrono = { workspace = true } clap = { workspace = true } humantime = { workspace = true } observe = { path = "../observe" } +mimalloc = { workspace = true } model = { path = "../model" } number = { path = "../number" } primitive-types = { workspace = true } diff --git a/crates/alerter/src/main.rs b/crates/alerter/src/main.rs index 5b9885156f..73a70ddf51 100644 --- a/crates/alerter/src/main.rs +++ b/crates/alerter/src/main.rs @@ -1,3 +1,6 @@ +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[tokio::main] async fn main() { alerter::start(std::env::args()).await; diff --git a/crates/autopilot/Cargo.toml b/crates/autopilot/Cargo.toml index d604acf173..ffa3a4901a 100644 --- a/crates/autopilot/Cargo.toml +++ b/crates/autopilot/Cargo.toml @@ -38,6 +38,7 @@ humantime = { workspace = true } indexmap = { workspace = true } itertools = { workspace = true } maplit = { workspace = true } +mimalloc = { workspace = true } model = { path = "../model" } num = { workspace = true } number = { path = "../number" } diff --git a/crates/autopilot/src/main.rs b/crates/autopilot/src/main.rs index b16e99d765..d3b40b5970 100644 --- a/crates/autopilot/src/main.rs +++ b/crates/autopilot/src/main.rs @@ -1,3 +1,6 @@ +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[tokio::main] async fn main() { autopilot::start(std::env::args()).await; diff --git a/crates/driver/Cargo.toml b/crates/driver/Cargo.toml index 0b491dd86b..254257d1c0 100644 --- a/crates/driver/Cargo.toml +++ b/crates/driver/Cargo.toml @@ -37,6 +37,7 @@ hyper = { workspace = true } lazy_static = { workspace = true } indexmap = { workspace = true, features = ["serde"] } itertools = { workspace = true } +mimalloc = { workspace = true } num = { workspace = true } number = { path = "../number" } prometheus = { workspace = true } diff --git a/crates/driver/src/main.rs b/crates/driver/src/main.rs index 0c18666e7f..13064f8724 100644 --- a/crates/driver/src/main.rs +++ b/crates/driver/src/main.rs @@ -1,3 +1,6 @@ +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[tokio::main] async fn main() { driver::start(std::env::args()).await; diff --git a/crates/orderbook/Cargo.toml b/crates/orderbook/Cargo.toml index 2e3e5833f4..5d89e6cdab 100644 --- a/crates/orderbook/Cargo.toml +++ b/crates/orderbook/Cargo.toml @@ -34,6 +34,7 @@ hex-literal = { workspace = true } humantime = { workspace = true } hyper = { workspace = true } maplit = { workspace = true } +mimalloc = { workspace = true } model = { path = "../model" } multibase = "0.9" num = { workspace = true } diff --git a/crates/orderbook/src/main.rs b/crates/orderbook/src/main.rs index 46d1a07652..b2f14d5ff2 100644 --- a/crates/orderbook/src/main.rs +++ b/crates/orderbook/src/main.rs @@ -1,3 +1,6 @@ +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[tokio::main] async fn main() { orderbook::start(std::env::args()).await; diff --git a/crates/refunder/Cargo.toml b/crates/refunder/Cargo.toml index 7276ef9b36..d201b78438 100644 --- a/crates/refunder/Cargo.toml +++ b/crates/refunder/Cargo.toml @@ -18,6 +18,7 @@ futures = {workspace = true} gas-estimation = { workspace = true } humantime = { workspace = true } lazy_static = { workspace = true } +mimalloc = "0.1.43" model = { path = "../model" } number = { path = "../number" } observe = { path = "../observe" } diff --git a/crates/refunder/src/main.rs b/crates/refunder/src/main.rs index a0770ff0e9..be0bb41fa5 100644 --- a/crates/refunder/src/main.rs +++ b/crates/refunder/src/main.rs @@ -1,3 +1,6 @@ +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[tokio::main] async fn main() { refunder::start(std::env::args()).await diff --git a/crates/solvers/Cargo.toml b/crates/solvers/Cargo.toml index 531ef55b3a..cd9cb3d297 100644 --- a/crates/solvers/Cargo.toml +++ b/crates/solvers/Cargo.toml @@ -24,6 +24,7 @@ futures = { workspace = true } hex = { workspace = true } hyper = { workspace = true } itertools = { workspace = true } +mimalloc = { workspace = true } num = { workspace = true } prometheus = { workspace = true } prometheus-metric-storage = { workspace = true } diff --git a/crates/solvers/src/main.rs b/crates/solvers/src/main.rs index 5c7901596f..09c582b3eb 100644 --- a/crates/solvers/src/main.rs +++ b/crates/solvers/src/main.rs @@ -1,3 +1,6 @@ +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[tokio::main] async fn main() { solvers::start(std::env::args()).await;