25 lines
770 B
Rust
25 lines
770 B
Rust
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);
|