From: Marco Costalba Date: Mon, 25 Jan 2010 10:07:30 +0000 (+0100) Subject: Copy only the search stack tail in split() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=56e09b4cc82c1cda42815482967670499fc64b61 Copy only the search stack tail in split() Only the previous, the current and the next ply SearchStack are copied. This reduces split overhead especially at low depth (high ply) and with many threads. Possibly no functional change (it is not easy to prove in SMP) Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index df74d580..f2057741 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -2986,15 +2986,15 @@ namespace { for (i = 0; i < ActiveThreads; i++) splitPoint->slaves[i] = 0; - // Copy the current search stack to the master thread - memcpy(splitPoint->sstack[master], sstck, (ply+1) * sizeof(SearchStack)); + // 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; // Make copies of the current position and search stack for each thread for (i = 0; i < ActiveThreads && splitPoint->cpus < MaxThreadsPerSplitPoint; i++) if (thread_is_available(i, master)) { - memcpy(splitPoint->sstack[i], sstck, (ply+1) * sizeof(SearchStack)); + memcpy(splitPoint->sstack[i] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack)); Threads[i].splitPoint = splitPoint; splitPoint->slaves[i] = 1; splitPoint->cpus++;