compiler optimizations + focus the benchmark futher
This commit is contained in:
@@ -4,24 +4,21 @@ use std::time::Duration;
|
||||
// use crate::future_move::FutureMove;
|
||||
use othello::{board::Board, future_moves::FutureMoves, piece::Piece};
|
||||
|
||||
fn future_move_bench(depth: usize, expire: usize) {
|
||||
fn extend_layers_test(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");
|
||||
}
|
||||
});
|
||||
fut.create_root_raw(Board::new().starting_pos());
|
||||
fut.extend_layers();
|
||||
}
|
||||
|
||||
fn criterion_benchmark(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("future_move (expire 4)");
|
||||
group.measurement_time(Duration::from_secs(60));
|
||||
const EXPIRE: usize = 4;
|
||||
let mut group = c.benchmark_group(format!("extend_layers (expire {})", EXPIRE));
|
||||
group.measurement_time(Duration::from_secs(10));
|
||||
|
||||
for (depth, expire) in [(2, 4), (3, 4), (4, 4), (5, 4), (6, 4)].iter() {
|
||||
group.throughput(Throughput::Elements(*depth as u64));
|
||||
group.bench_with_input(BenchmarkId::from_parameter(depth), depth, |b, depth| {
|
||||
b.iter(|| future_move_bench(*depth, *expire));
|
||||
for (depth, expire) in (2..6).zip([EXPIRE].iter().cycle()) {
|
||||
group.throughput(Throughput::Elements(depth as u64));
|
||||
group.bench_with_input(BenchmarkId::from_parameter(depth), &depth, |b, depth| {
|
||||
b.iter(|| extend_layers_test(*depth, *expire));
|
||||
});
|
||||
}
|
||||
group.finish();
|
||||
|
||||
Reference in New Issue
Block a user