aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-09-04 15:18:44 +0300
committereug-vs <eugene@eug-vs.xyz>2023-09-04 15:18:44 +0300
commitae858671cc21ee8516efea241f4c372fa3ccfaa6 (patch)
tree44bb2fc1d8ea644d7a681a1e2125bd86f7a53066
parent0198592b59f12e8dcfa5c0146f8109ab67176f1b (diff)
downloadchessnost-ae858671cc21ee8516efea241f4c372fa3ccfaa6.tar.gz
perf: do not reallocate Vecs in cleanup_selector
-rw-r--r--src/grossmeister/move_selector.rs9
1 files 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