From: xoto10 Date: Wed, 21 Oct 2020 13:52:13 +0000 (+0100) Subject: Reduce big time spikes by reducing PV re-searches. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=f5dfad5d72e164b57b787c0224046d641b3ade84 Reduce big time spikes by reducing PV re-searches. Save time by reducing PV re-searches above original depth. Instead use 5% extra time on every move. STC 10+0.1 th 1 : LLR: 2.93 (-2.94,2.94) {-0.25,1.25} Total: 90688 W: 9702 L: 9436 D: 71550 Ptnml(0-2): 408, 7252, 29792, 7450, 442 https://tests.stockfishchess.org/tests/view/5f8df807bacb75a4f9a47223 LTC 60+0.6 th 1 : LLR: 2.97 (-2.94,2.94) {0.25,1.25} Total: 97856 W: 4602 L: 4303 D: 88951 Ptnml(0-2): 53, 3757, 41057, 3960, 101 https://tests.stockfishchess.org/tests/view/5f8ec4872c92c7fe3a8c602d closes https://github.com/official-stockfish/Stockfish/pull/3192 Bench 3943959 --- diff --git a/src/search.cpp b/src/search.cpp index ab58ca64..65ed9b73 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -565,6 +565,7 @@ namespace { constexpr bool PvNode = NT == PV; const bool rootNode = PvNode && ss->ply == 0; + const Depth maxNextDepth = rootNode ? depth : depth + 1; // Check if we have an upcoming move which draws by repetition, or // if the opponent had an alternative move earlier to this position. @@ -1259,7 +1260,8 @@ moves_loop: // When in check, search starts from here (ss+1)->pv = pv; (ss+1)->pv[0] = MOVE_NONE; - value = -search(pos, ss+1, -beta, -alpha, newDepth, false); + value = -search(pos, ss+1, -beta, -alpha, + std::min(maxNextDepth, newDepth), false); } // Step 18. Undo move diff --git a/src/timeman.cpp b/src/timeman.cpp index 6d9c95ef..da08f12d 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -75,7 +75,7 @@ void TimeManagement::init(Search::LimitsType& limits, Color us, int ply) { // game time for the current move, so also cap to 20% of available game time. if (limits.movestogo == 0) { - optScale = std::min(0.008 + std::pow(ply + 3.0, 0.5) / 250.0, + optScale = std::min(0.0084 + std::pow(ply + 3.0, 0.5) * 0.0042, 0.2 * limits.time[us] / double(timeLeft)); maxScale = std::min(7.0, 4.0 + ply / 12.0); }