changes + benchmarks
This commit is contained in:
24
benches/future_children.rs
Normal file
24
benches/future_children.rs
Normal 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);
|
||||
Reference in New Issue
Block a user