39 lines
1.2 KiB
Rust
39 lines
1.2 KiB
Rust
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
|
use othello::{
|
|
logic::{FutureMoveConfig, FutureMoves},
|
|
repr::{Board, Piece},
|
|
};
|
|
|
|
fn extend_layers_no_pruning(depth: usize, arena_size: usize) -> usize {
|
|
let config = FutureMoveConfig {
|
|
max_depth: depth,
|
|
min_arena_depth_sub: 0,
|
|
top_k_children: 5,
|
|
up_to_minus: 4,
|
|
max_arena_size: arena_size,
|
|
do_not_prune: true,
|
|
};
|
|
let mut fut = FutureMoves::new(Piece::Black, config);
|
|
fut.set_root_from_board(Board::new().starting_pos());
|
|
fut.extend_layers();
|
|
fut.arena_len()
|
|
}
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
let mut group = c.benchmark_group("extend_layer (no pruning)");
|
|
const ARENA_SIZE: usize = 10_000_000;
|
|
|
|
for depth in 6..8 {
|
|
group.throughput(Throughput::Elements(
|
|
extend_layers_no_pruning(depth, ARENA_SIZE) as u64,
|
|
));
|
|
group.bench_with_input(BenchmarkId::from_parameter(depth), &depth, |b, depth| {
|
|
b.iter(|| extend_layers_no_pruning(*depth, ARENA_SIZE));
|
|
});
|
|
}
|
|
group.finish();
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches);
|