bench: add board place benchmark
This commit is contained in:
@@ -162,8 +162,9 @@ impl Board {
|
||||
}
|
||||
|
||||
/// Place a piece without checking for propegation of validity
|
||||
/// only pub for setting up benchmark
|
||||
#[const_fn(cfg(not(feature = "bitvec")))]
|
||||
const fn place_unchecked(&mut self, coord: CoordPair, piece: Piece) {
|
||||
pub const fn place_unchecked(&mut self, coord: CoordPair, piece: Piece) {
|
||||
self.board_mut(piece).set(coord, true);
|
||||
self.board_mut(piece.flip()).set(coord, false);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ pub fn gen_adj_lookup() -> PosMap<ChainCollection> {
|
||||
.map(Iterator::collect),
|
||||
)
|
||||
.chain(diag_raw(i_chain, j_chain).map(Iterator::collect))
|
||||
.filter(|x: &Vec<(u8, u8)>| !x.is_empty()) // PERF! filter out empty chains +~10-12% perf boost
|
||||
.filter(|x: &Vec<(u8, u8)>| !x.is_empty()) // PERF! filter out empty chains +~5% perf boost (in [`Board::place`])
|
||||
.map(|x: Vec<(u8, u8)>| x.into_iter().map(|x| x.into()).collect()),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user