Avoid calling evaluate() while razoring
authorMarco Costalba <mcostalba@gmail.com>
Sat, 5 Jun 2010 07:40:47 +0000 (09:40 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 5 Jun 2010 07:42:16 +0000 (09:42 +0200)
Micro optimization that gives a 0.5% speed improvment

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 65395b4ec95943171b5bafddde76d4bf0e41c0bb..5a2495d4fa65276ea618ccf1708d3c7bdff59166 100644 (file)
@@ -1148,6 +1148,10 @@ namespace {
         && !value_is_mate(beta)
         && !pos.has_pawn_on_7th(pos.side_to_move()))
     {
+        // Pass ss->eval to qsearch() and avoid an evaluate call
+        if (!tte || tte->static_value() == VALUE_NONE)
+            TT.store(posKey, ss->eval, VALUE_TYPE_EXACT, Depth(-127*OnePly), MOVE_NONE, ss->eval, ei.kingDanger[pos.side_to_move()]);
+
         Value rbeta = beta - razor_margin(depth);
         Value v = qsearch<NonPV>(pos, ss, rbeta-1, rbeta, Depth(0));
         if (v < rbeta)