]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Use fast_copy() instead of full copy in sp_search
[stockfish] / src / search.cpp
index f205774124063dca9e3fed76471d2e0083d89115..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;
@@ -2981,11 +2983,14 @@ namespace {
     splitPoint->mp = mp;
     splitPoint->moves = *moves;
     splitPoint->cpus = 1;
-    splitPoint->pos.copy(p);
+    splitPoint->pos.fast_copy(p);
     splitPoint->parentSstack = sstck;
     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;