Skip to content

Commit

Permalink
recalibrate benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
brunocodutra committed Nov 23, 2024
1 parent 36ab78c commit 0ba033a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions benches/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ use criterion_macro::criterion;
use lib::nnue::Evaluator;
use lib::search::{Depth, Engine, Limits, Options};
use lib::util::{Integer, Trigger};
use std::thread::available_parallelism;
use std::time::{Duration, Instant};
use std::{str::FromStr, thread::available_parallelism};

#[ctor::ctor]
static POSITION: Evaluator =
Evaluator::from_str("6br/1KNp1n1r/2p2p2/P1ppRP2/1kP3pP/3PBB2/PN1P4/8 w - - 0 1").unwrap();

fn bench(reps: u64, options: &Options, limits: &Limits) -> Duration {
let mut time = Duration::ZERO;

for _ in 0..reps {
let mut e = Engine::with_options(options);
let interrupter = Trigger::armed();
let pos = Evaluator::default();
let timer = Instant::now();
e.search(&POSITION, limits, &interrupter);
e.search(&pos, limits, &interrupter);
time += timer.elapsed();
}

Expand All @@ -40,7 +37,7 @@ fn crit(c: &mut Criterion) {
}));

for o in &options {
let depth = Depth::new(12);
let depth = Depth::new(14);
c.benchmark_group("ttd")
.sampling_mode(SamplingMode::Flat)
.bench_function(o.threads.to_string(), |b| {
Expand All @@ -49,7 +46,7 @@ fn crit(c: &mut Criterion) {
}

for o in &options {
let nodes = 300_000;
let nodes = 500_000;
c.benchmark_group("nps")
.sampling_mode(SamplingMode::Flat)
.throughput(Throughput::Elements(nodes))
Expand Down

0 comments on commit 0ba033a

Please sign in to comment.