Refactor elapsed time checks in search

Small improvement of the elapsed time usage in search, makes the code easier to read overall.
Also Search::Worker::iterative_deepening() now only checks the elapsed time once, instead of 3 times in a row.

Non Regression STC:
https://tests.stockfishchess.org/tests/view/6617005d5a4693796d965c3c
LLR: 2.97 (-2.94,2.94) <-1.75,0.25>
Total: 61024 W: 16002 L: 15806 D: 29216
Ptnml(0-2): 243, 6874, 16102, 7030, 263

closes https://github.com/official-stockfish/Stockfish/pull/5163

No functional change
This commit is contained in:
Disservin
2024-04-10 23:10:07 +02:00
committed by Joost VandeVondele
parent 432995ad82
commit d3fc1d835e
4 changed files with 21 additions and 18 deletions

View File

@@ -30,9 +30,6 @@ namespace Stockfish {
TimePoint TimeManagement::optimum() const { return optimumTime; }
TimePoint TimeManagement::maximum() const { return maximumTime; }
TimePoint TimeManagement::elapsed(size_t nodes) const {
return useNodesTime ? TimePoint(nodes) : now() - startTime;
}
void TimeManagement::clear() {
availableNodes = 0; // When in 'nodes as time' mode