From c9d73d1aa5cf609b626776a112cd699339fefb67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Oster?= Date: Sun, 30 Jun 2019 15:16:20 +0200 Subject: [PATCH] Try to get a more precise bench time (#2211) Initialization of larger hash sizes can take some time. Don't include this time in the bench by resetting the timer after Search::clear(). Also move 'ucinewgame' command down in the list, so that it is processed after the configuration of Threads and Hash size. No functional change. --- src/benchmark.cpp | 2 +- src/uci.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/benchmark.cpp b/src/benchmark.cpp index 51bd7949..b23c5d17 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -139,9 +139,9 @@ vector setup_bench(const Position& current, istream& is) { file.close(); } - list.emplace_back("ucinewgame"); list.emplace_back("setoption name Threads value " + threads); list.emplace_back("setoption name Hash value " + ttSize); + list.emplace_back("ucinewgame"); for (const string& fen : fens) if (fen.find("setoption") != string::npos) diff --git a/src/uci.cpp b/src/uci.cpp index 739cf343..a4235f2b 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -164,7 +164,7 @@ namespace { } else if (token == "setoption") setoption(is); else if (token == "position") position(pos, is, states); - else if (token == "ucinewgame") Search::clear(); + else if (token == "ucinewgame") { Search::clear(); elapsed = now(); } // Search::clear() may take some while } elapsed = now() - elapsed + 1; // Ensure positivity to avoid a 'divide by zero' -- 2.39.2