mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Reduce lock contention in sp_search_pv()
In less then 1% of cases value > sp->bestValue, so avoid an useless lock in the common case. This is the same change already applied to sp_search(). Also SplitPoint futilityValue is not volatile because never changes after has been assigned in split() No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
5ca4284027
commit
cf9bf4e58f
2 changed files with 30 additions and 26 deletions
|
@ -2046,6 +2046,8 @@ namespace {
|
|||
break;
|
||||
|
||||
// New best move?
|
||||
if (value > sp->bestValue) // Less then 2% of cases
|
||||
{
|
||||
lock_grab(&(sp->lock));
|
||||
if (value > sp->bestValue && !thread_should_stop(threadID))
|
||||
{
|
||||
|
@ -2078,6 +2080,7 @@ namespace {
|
|||
}
|
||||
lock_release(&(sp->lock));
|
||||
}
|
||||
}
|
||||
|
||||
lock_grab(&(sp->lock));
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@ struct SplitPoint {
|
|||
SearchStack *parentSstack;
|
||||
int ply;
|
||||
Depth depth;
|
||||
volatile Value alpha, beta, bestValue, futilityValue;
|
||||
volatile Value alpha, beta, bestValue;
|
||||
Value futilityValue;
|
||||
bool pvNode;
|
||||
int master, slaves[THREAD_MAX];
|
||||
Lock lock;
|
||||
|
|
Loading…
Add table
Reference in a new issue