Skip to content

Commit

Permalink
Merge pull request #290 from neherlab/perf/jemalloc
Browse files Browse the repository at this point in the history
perf: set jemalloc as global allocator
  • Loading branch information
ivan-aksamentov authored Dec 6, 2024
2 parents 20c5b36 + 1acf00b commit 4538fd6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ statrs = "=0.17.1"
strum = "=0.26.3"
strum_macros = "=0.26.4"
textplots = "=0.8.6"
tikv-jemallocator = "=0.6.0"
time = { version = "=0.3.36", features = ["serde", "macros", "parsing"] }
traversal = "=0.1.2"
typify = { version = "=0.2.0", features = ["macro"] }
Expand Down
14 changes: 14 additions & 0 deletions packages/treetime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,23 @@ serde_yaml = { workspace = true }
smart-default = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
tikv-jemallocator = { workspace = true, optional = true }
time = { workspace = true }
traversal = { workspace = true }

[target.'cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))'.dependencies]
tikv-jemallocator = { workspace = true }

[target.'cfg(all(target_arch = "aarch64", target_os = "linux", target_env = "gnu"))'.dependencies]
tikv-jemallocator = { workspace = true }

[target.'cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "musl"))'.dependencies]
tikv-jemallocator = { workspace = true }

[target.'cfg(all(target_arch = "aarch64", target_os = "linux", target_env = "musl"))'.dependencies]
tikv-jemallocator = { workspace = true }


[features]
"png" = ["image", "plotters/bitmap_backend", "plotters/ttf"]

Expand Down
9 changes: 9 additions & 0 deletions packages/treetime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ pub mod representation;
pub mod seq;
pub mod utils;

#[cfg(any(
all(target_arch = "aarch64", target_os = "linux", target_env = "gnu"),
all(target_arch = "aarch64", target_os = "linux", target_env = "musl"),
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
all(target_arch = "x86_64", target_os = "linux", target_env = "musl"),
))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

#[cfg(test)]
mod tests {
use crate::utils::global_init::global_init;
Expand Down

0 comments on commit 4538fd6

Please sign in to comment.