From f148a8f6ccbb57c440910ecfd4845c7f497b5404 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Wed, 2 Jun 2010 14:18:23 +0100 Subject: [PATCH] Don't initialize excludedMove and skipNullMove at each node Do it once at the beginning becuase they are always reset after use in the calling place where are set. No functional change also with faked split. Signed-off-by: Marco Costalba --- src/search.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 7f885f7a..7ab74998 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -313,7 +313,7 @@ namespace { void poll(); void ponderhit(); void wait_for_stop_or_ponderhit(); - void init_ss_array(SearchStack* ss); + void init_ss_array(SearchStack* ss, int size); void print_pv_info(const Position& pos, SearchStack* ss, Value alpha, Value beta, Value value); #if !defined(_MSC_VER) @@ -633,7 +633,7 @@ namespace { // Initialize TT.new_search(); H.clear(); - init_ss_array(ss); + init_ss_array(ss, PLY_MAX_PLUS_2); ValueByIteration[1] = rml.get_move_score(0); p.reset_ply(); Iteration = 1; @@ -1058,8 +1058,6 @@ namespace { // Step 1. Initialize node and poll. Polling can abort search TM.incrementNodeCounter(threadID); ss->init(ply); - (ss + 1)->excludedMove = MOVE_NONE; - (ss + 1)->skipNullMove = false; (ss + 2)->initKillers(); if (threadID == 0 && ++NodesSincePoll > NodesBetweenPolls) @@ -2235,16 +2233,21 @@ namespace { } - // init_ss_array() does a fast reset of the first entries of a SearchStack array + // init_ss_array() does a fast reset of the first entries of a SearchStack + // array and of all the excludedMove and skipNullMove entries. - void init_ss_array(SearchStack* ss) { + void init_ss_array(SearchStack* ss, int size) { - for (int i = 0; i < 3; i++, ss++) + for (int i = 0; i < size; i++, ss++) { - ss->init(i); - ss->initKillers(); ss->excludedMove = MOVE_NONE; ss->skipNullMove = false; + + if (i < 3) + { + ss->init(i); + ss->initKillers(); + } } } @@ -2776,7 +2779,7 @@ namespace { continue; // Find a quick score for the move - init_ss_array(ss); + init_ss_array(ss, PLY_MAX_PLUS_2); pos.do_move(cur->move, st); moves[count].move = cur->move; moves[count].score = -qsearch(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 0); -- 2.39.2