mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 08:36:33 +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:
@@ -136,7 +136,7 @@ void MovePicker::go_next_phase() {
|
||||
case PH_NONCAPTURES:
|
||||
lastMove = generate_noncaptures(pos, moves);
|
||||
score_noncaptures();
|
||||
sort_moves(moves, lastMove);
|
||||
sort_moves(moves, lastMove, &lastGoodNonCapture);
|
||||
return;
|
||||
|
||||
case PH_BAD_CAPTURES:
|
||||
@@ -305,6 +305,11 @@ Move MovePicker::get_next_move() {
|
||||
break;
|
||||
|
||||
case PH_NONCAPTURES:
|
||||
|
||||
// Sort negative scored moves only when we get there
|
||||
if (curMove == lastGoodNonCapture)
|
||||
insertion_sort(lastGoodNonCapture, lastMove);
|
||||
|
||||
move = (curMove++)->move;
|
||||
if ( move != ttMoves[0].move
|
||||
&& move != ttMoves[1].move
|
||||
|
||||
Reference in New Issue
Block a user