38 lines
1.2 KiB
Rust
38 lines
1.2 KiB
Rust
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
|
use othello::{
|
|
logic::{ChildrenEvalMethod, FutureMoveConfig, FutureMoves},
|
|
repr::{Board, Piece},
|
|
};
|
|
|
|
fn extend_layers_no_pruning(depth: usize) -> usize {
|
|
let config = FutureMoveConfig {
|
|
max_depth: depth,
|
|
min_arena_depth: 0,
|
|
top_k_children: 5,
|
|
up_to_minus: 4,
|
|
max_arena_size: usize::MAX,
|
|
do_prune: false,
|
|
print: false,
|
|
children_eval_method: ChildrenEvalMethod::AverageDivDepth,
|
|
};
|
|
let mut fut = FutureMoves::new(Piece::Black, config);
|
|
fut.update_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)");
|
|
|
|
for depth in 6..8 {
|
|
group.throughput(Throughput::Elements(extend_layers_no_pruning(depth) as u64));
|
|
group.bench_with_input(BenchmarkId::from_parameter(depth), &depth, |b, depth| {
|
|
b.iter(|| extend_layers_no_pruning(*depth));
|
|
});
|
|
}
|
|
group.finish();
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches);
|