mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Make mimalloc optional for udp and http
This commit is contained in:
parent
f061c47ef8
commit
7795a1a532
5 changed files with 21 additions and 5 deletions
|
|
@ -18,9 +18,13 @@ name = "aquatic_http"
|
||||||
name = "aquatic_http"
|
name = "aquatic_http"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["prometheus"]
|
default = ["prometheus", "mimalloc"]
|
||||||
prometheus = ["aquatic_common/prometheus", "metrics", "dep:metrics-util"]
|
prometheus = ["aquatic_common/prometheus", "metrics", "dep:metrics-util"]
|
||||||
metrics = ["dep:metrics"]
|
metrics = ["dep:metrics"]
|
||||||
|
# Use mimalloc allocator for much better performance.
|
||||||
|
#
|
||||||
|
# Requires cmake and a C compiler
|
||||||
|
mimalloc = ["dep:mimalloc"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
aquatic_common = { workspace = true, features = ["rustls"] }
|
aquatic_common = { workspace = true, features = ["rustls"] }
|
||||||
|
|
@ -40,7 +44,6 @@ httparse = "1"
|
||||||
itoa = "1"
|
itoa = "1"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mimalloc = { version = "0.1", default-features = false }
|
|
||||||
memchr = "2"
|
memchr = "2"
|
||||||
privdrop = "0.5"
|
privdrop = "0.5"
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
|
|
@ -56,6 +59,9 @@ thiserror = "1"
|
||||||
metrics = { version = "0.22", optional = true }
|
metrics = { version = "0.22", optional = true }
|
||||||
metrics-util = { version = "0.16", optional = true }
|
metrics-util = { version = "0.16", optional = true }
|
||||||
|
|
||||||
|
# mimalloc feature
|
||||||
|
mimalloc = { version = "0.1", default-features = false, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
quickcheck = "1"
|
quickcheck = "1"
|
||||||
quickcheck_macros = "1"
|
quickcheck_macros = "1"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use aquatic_common::cli::run_app_with_cli_and_config;
|
use aquatic_common::cli::run_app_with_cli_and_config;
|
||||||
use aquatic_http::config::Config;
|
use aquatic_http::config::Config;
|
||||||
|
|
||||||
|
#[cfg(feature = "mimalloc")]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,17 @@ name = "aquatic_udp"
|
||||||
name = "aquatic_udp"
|
name = "aquatic_udp"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["prometheus"]
|
default = ["prometheus", "mimalloc"]
|
||||||
# Export prometheus metrics
|
# Export prometheus metrics
|
||||||
prometheus = ["metrics", "aquatic_common/prometheus"]
|
prometheus = ["metrics", "aquatic_common/prometheus"]
|
||||||
# Experimental io_uring support (Linux 6.0 or later required)
|
# Experimental io_uring support (Linux 6.0 or later required)
|
||||||
io-uring = ["dep:io-uring"]
|
io-uring = ["dep:io-uring"]
|
||||||
# Experimental CPU pinning support
|
# Experimental CPU pinning support
|
||||||
cpu-pinning = ["aquatic_common/cpu-pinning"]
|
cpu-pinning = ["aquatic_common/cpu-pinning"]
|
||||||
|
# Use mimalloc allocator for much better performance.
|
||||||
|
#
|
||||||
|
# Requires cmake and a C compiler
|
||||||
|
mimalloc = ["dep:mimalloc"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
aquatic_common.workspace = true
|
aquatic_common.workspace = true
|
||||||
|
|
@ -45,7 +49,6 @@ hdrhistogram = "7"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mimalloc = { version = "0.1", default-features = false }
|
|
||||||
mio = { version = "0.8", features = ["net", "os-poll"] }
|
mio = { version = "0.8", features = ["net", "os-poll"] }
|
||||||
num-format = "0.4"
|
num-format = "0.4"
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
|
|
@ -63,6 +66,9 @@ metrics = { version = "0.22", optional = true }
|
||||||
# io-uring feature
|
# io-uring feature
|
||||||
io-uring = { version = "0.6", optional = true }
|
io-uring = { version = "0.6", optional = true }
|
||||||
|
|
||||||
|
# mimalloc feature
|
||||||
|
mimalloc = { version = "0.1", default-features = false, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
quickcheck = "1"
|
quickcheck = "1"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[cfg(feature = "mimalloc")]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ hashbrown = { version = "0.14", features = ["serde"] }
|
||||||
httparse = "1"
|
httparse = "1"
|
||||||
indexmap = "2"
|
indexmap = "2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mimalloc = { version = "0.1", default-features = false, optional = true }
|
|
||||||
privdrop = "0.5"
|
privdrop = "0.5"
|
||||||
rand = { version = "0.8", features = ["small_rng"] }
|
rand = { version = "0.8", features = ["small_rng"] }
|
||||||
rustls = "0.23"
|
rustls = "0.23"
|
||||||
|
|
@ -60,6 +59,9 @@ tungstenite = "0.21"
|
||||||
metrics = { version = "0.22", optional = true }
|
metrics = { version = "0.22", optional = true }
|
||||||
metrics-util = { version = "0.16", optional = true }
|
metrics-util = { version = "0.16", optional = true }
|
||||||
|
|
||||||
|
# mimalloc feature
|
||||||
|
mimalloc = { version = "0.1", default-features = false, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
quickcheck = "1"
|
quickcheck = "1"
|
||||||
quickcheck_macros = "1"
|
quickcheck_macros = "1"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue