From: Marco Costalba Date: Mon, 25 Jan 2010 11:07:59 +0000 (+0100) Subject: Use fast_copy() instead of full copy in sp_search X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=c2df60048e8fbbca5dff66b98e4e0f4bf1413821 Use fast_copy() instead of full copy in sp_search 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 --- diff --git a/src/search.cpp b/src/search.cpp index 31de0b01..2244a2f7 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -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;