]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Optimize futilityValue calculation
[stockfish] / src / search.cpp
index 58b60c878d872f986157e84a823386a40b33a0d5..b513871a2fa2820004ea719ed2dec82c015857cd 100644 (file)
@@ -1333,6 +1333,10 @@ namespace {
     bool useFutilityPruning =   depth < SelectiveDepth
                              && !isCheck;
 
+    // Avoid calling evaluate() if we already have the score in TT
+    if (tte && (tte->type() & VALUE_TYPE_EVAL))
+        futilityValue = value_from_tt(tte->value(), ply) + FutilityMargins[int(depth) - 2];
+
     // Loop through all legal moves until no moves remain or a beta cutoff
     // occurs.
     while (   bestValue < beta