]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Clarify we don't late join with only 2 threads
[stockfish] / src / search.cpp
index a04766533b953f27798b7665c4a1d99c76bc4f82..15b93a728de884211a0ed864963010d502c2a9c9 100644 (file)
@@ -1594,7 +1594,7 @@ void Thread::idle_loop() {
 
           for (size_t i = 0; i < Threads.size(); ++i)
           {
-              const int size = Threads[i]->splitPointsSize; // Local copy
+              const size_t size = Threads[i]->splitPointsSize; // Local copy
               sp = size ? &Threads[i]->splitPoints[size - 1] : NULL;
 
               if (   sp
@@ -1604,8 +1604,10 @@ void Thread::idle_loop() {
               {
                   assert(this != Threads[i]);
                   assert(!(this_sp && this_sp->slavesMask.none()));
+                  assert(Threads.size() > 2);
 
-                  // Compute the recursive split points chain size
+                  // Prefer to join to SP with few parents to reduce the probability
+                  // that a cut-off occurs above us, and hence we waste our work.
                   int level = -1;
                   for (SplitPoint* spp = Threads[i]->activeSplitPoint; spp; spp = spp->parentSplitPoint)
                       level++;
@@ -1705,7 +1707,7 @@ void check_time() {
       // Loop across all split points and sum accumulated SplitPoint nodes plus
       // all the currently active positions nodes.
       for (size_t i = 0; i < Threads.size(); ++i)
-          for (int j = 0; j < Threads[i]->splitPointsSize; ++j)
+          for (size_t j = 0; j < Threads[i]->splitPointsSize; ++j)
           {
               SplitPoint& sp = Threads[i]->splitPoints[j];