Skip to content

Commit

Permalink
tcmalloc on main.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
thesuzerain committed Jan 14, 2024
1 parent fc57724 commit 79529ae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ lettre = "0.11.3"
derive-new = "0.6.0"
rust_iso3166 = "0.1.11"


tcmalloc = {version = "0.3.0", optional = true}

[dev-dependencies]
actix-http = "3.4.0"
json-patch = "*"
Expand All @@ -116,3 +119,6 @@ opt-level = 0 # Minimal optimization, speeds up compilation
lto = false # Disables Link Time Optimization
incremental = true # Enables incremental compilation
codegen-units = 16 # Higher number can improve compile times but reduce runtime performance

[features]
tcmalloc = ["dep:tcmalloc"]
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ use labrinth::{check_env_vars, clickhouse, database, file_hosting, queue};
use log::{error, info};
use std::sync::Arc;

#[cfg(feature = "tcmalloc")]
use tcmalloc::TCMalloc;

#[cfg(feature = "tcmalloc")]
#[global_allocator]
static GLOBAL: TCMalloc = TCMalloc;

#[derive(Clone)]
pub struct Pepper {
pub pepper: String,
Expand Down

0 comments on commit 79529ae

Please sign in to comment.