changes + benchmarks

This commit is contained in:
2025-02-18 15:04:21 -05:00
parent ad28713775
commit 0d0b5786a2
7 changed files with 805 additions and 383 deletions

View File

@@ -0,0 +1,24 @@
use criterion::{criterion_group, criterion_main, Criterion};
use std::hint::black_box;
// use crate::future_move::FutureMove;
use othello::{board::Board, future_moves::FutureMoves, piece::Piece};
fn future_move_bench(depth: usize, expire: usize) {
let mut fut = FutureMoves::new(Piece::Black, depth, expire);
fut.update(&Board::new().starting_pos());
let _best_move = fut.best_move().inspect(|&(i, j)| {
if !fut.update_root_coord(i, j) {
panic!("update_root_coord failed");
}
});
}
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("depth 6 expire 4", |b| {
b.iter(|| future_move_bench(black_box(6), black_box(4)))
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);