From ae858671cc21ee8516efea241f4c372fa3ccfaa6 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Mon, 4 Sep 2023 15:18:44 +0300 Subject: perf: do not reallocate Vecs in cleanup_selector --- src/grossmeister/move_selector.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/grossmeister/move_selector.rs b/src/grossmeister/move_selector.rs index c55051e..08e5cf1 100644 --- a/src/grossmeister/move_selector.rs +++ b/src/grossmeister/move_selector.rs @@ -86,10 +86,11 @@ impl Grossmeister { } pub fn cleanup_selector(&mut self) { - // Keep the killers! - let killers = self.move_selector().killer_moves.clone(); - *self.move_selector() = MoveSelector::default(); - self.move_selector().killer_moves = killers; + let selector = self.move_selector(); + selector.tactical_moves.clear(); + selector.stage_moves.moves.clear(); + selector.stage_moves.index = 0; + selector.stage = MoveGenStage::default(); } /// Register killer for ply-before -- cgit v1.2.3