mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Delay sorting of negative scored non-captures
We can do this only when needed, if we get a cut-off before we skip sorting entirely. This reduces sorting time of about 20%. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -89,7 +89,7 @@ inline void insertion_sort(T* firstMove, T* lastMove)
|
||||
// Our dedicated sort in range [firstMove, lastMove), first splits
|
||||
// positive scores from ramining then order seaprately the two sets.
|
||||
template<typename T>
|
||||
inline void sort_moves(T* firstMove, T* lastMove)
|
||||
inline void sort_moves(T* firstMove, T* lastMove, T** lastPositive)
|
||||
{
|
||||
T tmp;
|
||||
T *p, *d;
|
||||
@@ -114,9 +114,9 @@ inline void sort_moves(T* firstMove, T* lastMove)
|
||||
|
||||
} while (p != d);
|
||||
|
||||
// Sort positives and non-positives separately
|
||||
// Sort just positive scored moves, remaining only when we get there
|
||||
insertion_sort<T>(firstMove, p);
|
||||
insertion_sort<T>(p, lastMove);
|
||||
*lastPositive = p;
|
||||
}
|
||||
|
||||
// Picks up the best move in range [curMove, lastMove), one per cycle.
|
||||
|
||||
Reference in New Issue
Block a user