]> git.sesse.net Git - stockfish/commitdiff
Use fast_copy() instead of full copy in sp_search
authorMarco Costalba <mcostalba@gmail.com>
Mon, 25 Jan 2010 11:07:59 +0000 (12:07 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 25 Jan 2010 11:13:16 +0000 (12:13 +0100)
And detach splitPoint Position from the master one.

So we duplicate StateInfo only once in split() instead
of one for each thread in sp_search

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 31de0b01e4979e5f5fd23adff739e000b7d4dcd3..2244a2f7da805599ea07d260134c52e2ee3e6b16 100644 (file)
@@ -1813,7 +1813,8 @@ namespace {
     assert(threadID >= 0 && threadID < ActiveThreads);
     assert(ActiveThreads > 1);
 
-    Position pos = Position(sp->pos);
+    Position pos;
+    pos.fast_copy(sp->pos);
     CheckInfo ci(pos);
     SearchStack* ss = sp->sstack[threadID];
     Value value = -VALUE_INFINITE;
@@ -1955,7 +1956,8 @@ namespace {
     assert(threadID >= 0 && threadID < ActiveThreads);
     assert(ActiveThreads > 1);
 
-    Position pos = Position(sp->pos);
+    Position pos;
+    pos.fast_copy(sp->pos);
     CheckInfo ci(pos);
     SearchStack* ss = sp->sstack[threadID];
     Value value = -VALUE_INFINITE;
@@ -2986,6 +2988,9 @@ namespace {
     for (i = 0; i < ActiveThreads; i++)
         splitPoint->slaves[i] = 0;
 
+    // Detach splitPoint Position from the master one
+    splitPoint->pos.detach();
+
     // Copy the tail of current search stack to the master thread
     memcpy(splitPoint->sstack[master] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
     Threads[master].splitPoint = splitPoint;