Skip to content

Commit

Permalink
feat(deps): 🚩 make mimalloc optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisu-Woniu committed Apr 25, 2024
1 parent 0eb952e commit c1f06cb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 27 deletions.
53 changes: 32 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ anyhow = "1.0.82"
clap = { version = "4.5.4", features = ["derive"] }
env_logger = "0.11.3"
log.workspace = true
mimalloc = "0.1.41"
mimalloc = { version = "0.1.41", optional = true }
serde = { version = "1.0.197", features = ["derive"] }
sysinfo = { version = "0.30.11", features = ["serde"] }
tokio = { version = "1.37.0", features = ["fs", "rt-multi-thread", "macros", "process"] }
Expand All @@ -161,16 +161,13 @@ toml = "0.8.12"
# Unused for now:
# nix = { version = "0.27.1", features = ["fs"] }
# strfmt = "0.2.4"
# uzers = "0.11.3"

# [dev-dependencies]
# tokio = { version = "1.37.0", features = ["rt-multi-thread", "macros"] }

[features]
grpc = ["dep:rsjudge-grpc", "rsjudge-grpc/serde"]
rest = ["dep:rsjudge-rest"]
rabbitmq = ["dep:rsjudge-rabbitmq", "rsjudge-rabbitmq/serde"]
default = ["grpc", "rest", "rabbitmq"]
mimalloc = ["dep:mimalloc"]
default = ["grpc", "rest", "rabbitmq", "mimalloc"]

[build-dependencies]
clap = { version = "4.5.4", features = ["derive"] }
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
#![cfg_attr(not(test), warn(clippy::print_stdout, clippy::print_stderr))]

use log::error;
#[cfg(feature = "mimalloc")]
use mimalloc::MiMalloc;
use rsjudge::main_impl;

#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;

Expand Down

0 comments on commit c1f06cb

Please sign in to comment.