diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-08-31 11:47:53 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-08-31 11:48:13 +0300 |
commit | 1891aed81193bd8913e806f58cfc802c13f9df1e (patch) | |
tree | 3b5a13053894fdecbef1cfc70de89f8e73090d02 | |
parent | e08dd1256b8a6d8197e56867b43b47a92aadd1a7 (diff) | |
download | chessnost-1891aed81193bd8913e806f58cfc802c13f9df1e.tar.gz |
perf: allocate killer moves on the stack
-rw-r--r-- | src/grossmeister/move_selector.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/grossmeister/move_selector.rs b/src/grossmeister/move_selector.rs index 3ca2f1a..d26ffc0 100644 --- a/src/grossmeister/move_selector.rs +++ b/src/grossmeister/move_selector.rs @@ -74,7 +74,7 @@ impl MoveGenStage { pub struct MoveSelector { all_moves: ScoredMoveList, stage_moves: ScoredMoveIter, - pub killer_moves: MoveList, + pub killer_moves: SmallVec<[Move; 4]>, stage: MoveGenStage, } @@ -98,8 +98,8 @@ impl Grossmeister { let parent_killers = &mut self.move_selectors[(self.board.ply - 2) as usize].killer_moves; match parent_killers.iter().find(|m| **m == killer) { None => { - // println!("Registering killer {:?} for ply {}", killer, self.board.ply - 1); parent_killers.push(killer); + debug_assert!(!parent_killers.spilled(), "Killer move list should remain on the stack"); // We want to have max 3 killers, so if we exceed the limit remove the oldest killer if parent_killers.len() > 3 { parent_killers.remove(0); |