Skip to content

Commit

Permalink
Assign improving only once
Browse files Browse the repository at this point in the history
Avoid duplicated code after recent commit "Use evaluation trend
to adjust futility margin". We initialize the improving variable
to true in the check case, which allows to avoid redundant code
in the general case.

Tested for speed by snicolet, patch seems about 0.4% faster.

No functional change.

Note: initializing the improving variable to false in the check
case was tested as a functional change, ending yellow in both STC
and LTC. This change is not included in the commit, but it is an
interesting result that could become part of a future patch about
improving or LMR. Reference of the LTC yellow test:
http://tests.stockfishchess.org/tests/view/5aa131560ebc590297cb636e
  • Loading branch information
vondele authored and snicolet committed Mar 10, 2018
1 parent 1093047 commit 2c5dfb3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ namespace {
if (inCheck)
{
ss->staticEval = eval = VALUE_NONE;
improving = true;
goto moves_loop;
}
else if (ttHit)
Expand All @@ -678,7 +679,6 @@ namespace {
}

improving = ss->staticEval >= (ss-2)->staticEval
/* || ss->staticEval == VALUE_NONE Already implicit in the previous condition */
||(ss-2)->staticEval == VALUE_NONE;

if (skipEarlyPruning || !pos.non_pawn_material(pos.side_to_move()))
Expand Down Expand Up @@ -816,9 +816,6 @@ namespace {

MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory, contHist, countermove, ss->killers);
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
improving = ss->staticEval >= (ss-2)->staticEval
/* || ss->staticEval == VALUE_NONE Already implicit in the previous condition */
||(ss-2)->staticEval == VALUE_NONE;

singularExtensionNode = !rootNode
&& depth >= 8 * ONE_PLY
Expand Down

0 comments on commit 2c5dfb3

Please sign in to comment.