From 1891aed81193bd8913e806f58cfc802c13f9df1e Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 31 Aug 2023 11:47:53 +0300 Subject: perf: allocate killer moves on the stack --- src/grossmeister/move_selector.rs | 4 ++-- 1 file 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); -- cgit v1.2.3