Skip to content

Commit

Permalink
use jemalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Dec 20, 2024
1 parent ca6f024 commit 6273376
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
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 @@ -28,6 +28,7 @@ tower-http = { version = "0.6", features = ["trace"] }
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
tracing = "0.1"
antichess-tb-sys = "0.1"
tikv-jemallocator = "0.6.0"

[profile.release]
lto = true
2 changes: 1 addition & 1 deletion src/antichess_tb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub unsafe fn probe_dtw(pos: &VariantPosition) -> Option<i32> {
match result {
0 => Some(dtw as i32),
1 => Some(dtw as i32), // cursed win/loss
2 => Some(0), // draw
2 => Some(0), // draw
error => {
warn!("antichess tb probe failed with error code {error}");
None
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use clap::{builder::PathBufValueParser, ArgAction, CommandFactory as _, Parser};
use listenfd::ListenFd;
use moka::future::Cache;
use shakmaty_syzygy::filesystem::{MmapFilesystem, OsFilesystem};
use tikv_jemallocator::Jemalloc;
use tokio::net::TcpListener;
use tower_http::trace::TraceLayer;
use tracing::{info, info_span, trace, Instrument as _};
Expand All @@ -37,6 +38,9 @@ use crate::{
tablebases::Tablebases,
};

#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[derive(Parser, Debug)]
struct Opt {
/// Directory with Syzygy tablebase files for standard chess.
Expand Down

0 comments on commit 6273376

Please sign in to comment.