]> git.sesse.net Git - stockfish/commitdiff
Try to get a more precise bench time (#2211)
authorJörg Oster <osterj165@googlemail.com>
Sun, 30 Jun 2019 13:16:20 +0000 (15:16 +0200)
committerMarco Costalba <mcostalba@users.noreply.github.com>
Sun, 30 Jun 2019 13:16:20 +0000 (15:16 +0200)
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
src/uci.cpp

index 51bd7949d1a2b2386d8da1b1f8c9a5432a0b146e..b23c5d17ef70ce90bb8225237f1f068373ca941e 100644 (file)
@@ -139,9 +139,9 @@ vector<string> setup_bench(const Position& current, istream& is) {
       file.close();
   }
 
       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("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)
 
   for (const string& fen : fens)
       if (fen.find("setoption") != string::npos)
index 739cf34347f497782c16526d64849b9058a237f7..a4235f2b23fb601c535f91c33f4d7c1b0ab36f77 100644 (file)
@@ -164,7 +164,7 @@ namespace {
         }
         else if (token == "setoption")  setoption(is);
         else if (token == "position")   position(pos, is, states);
         }
         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'
     }
 
     elapsed = now() - elapsed + 1; // Ensure positivity to avoid a 'divide by zero'