summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4d90aeb)
In case we have less then 10ms to think as soon as
we wake up the timer, it immediately fires and calls
check_time() where due to condition:
elapsed > TimeMgr.maximum_time() - 2 * TimerResolution
the stop flag is set and search returns immediately, without
actually search anything.
Here the somewhat hacky fix is to start the timer after
at least one iteration as been completed.
No functional change.
Threads.sleepWhileIdle = Options["Idle Threads Sleep"];
// Set best timer interval to avoid lagging under time pressure. Timer is
Threads.sleepWhileIdle = Options["Idle Threads Sleep"];
// Set best timer interval to avoid lagging under time pressure. Timer is
- // used to check for remaining available thinking time.
+ // used to check for remaining available thinking time. Timer will be started
+ // at the end of first iteration to avoid returning with a random move.
Threads.timer->msec =
Limits.use_time_management() ? std::min(100, std::max(TimeMgr.available_time() / 16, TimerResolution)) :
Threads.timer->msec =
Limits.use_time_management() ? std::min(100, std::max(TimeMgr.available_time() / 16, TimerResolution)) :
- Limits.nodes ? 2 * TimerResolution
- : 100;
-
- Threads.timer->notify_one(); // Wake up the recurring timer
+ Limits.nodes ? 2 * TimerResolution : 100;
id_loop(RootPos); // Let's start searching !
id_loop(RootPos); // Let's start searching !
assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE);
}
assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE);
}
+ // Wake up the recurring timer after first iteration is finished
+ if (depth == 1)
+ Threads.timer->notify_one();
+
// Sort the PV lines searched so far and update the GUI
std::stable_sort(RootMoves.begin(), RootMoves.begin() + PVIdx + 1);
// Sort the PV lines searched so far and update the GUI
std::stable_sort(RootMoves.begin(), RootMoves.begin() + PVIdx + 1);