Skip to content

Commit

Permalink
Add new benchmark: solve_inner_parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
primenumber committed Apr 29, 2024
1 parent 0639da1 commit 26a6625
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/engine/endgame/test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extern crate test;
use super::*;
use crate::setup::*;
use rayon::prelude::*;
use std::fs::File;
use std::io::{BufRead, BufReader};
use test::Bencher;
Expand Down Expand Up @@ -59,3 +60,21 @@ fn bench_solve_inner(b: &mut Bencher) {
}
});
}

#[bench]
fn bench_solve_inner_parallel(b: &mut Bencher) {
let solve_obj = setup_default();
let dataset = load_stress_test_set();

b.iter(|| {
dataset.par_iter().for_each(|&(board, _desired)| {
let mut obj = solve_obj.clone();
let (_res, _stat) = solve_inner(
&mut obj,
board,
(-(BOARD_SIZE as i8), BOARD_SIZE as i8),
false,
);
});
});
}

0 comments on commit 26a6625

Please sign in to comment.