]> git.sesse.net Git - stockfish/commitdiff
Speed up sorting of non-captures
authorMarco Costalba <mcostalba@gmail.com>
Tue, 24 Nov 2009 12:39:47 +0000 (13:39 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 25 Nov 2009 16:42:41 +0000 (17:42 +0100)
Becasue we have a lot of zero scores (around 30% of moves)
it is a good idea to do a couple a presorting loops across
the move list and shuffle the moves a bit so that with a
small effort we end up with 3 groups of moves: positives
scores, zero scores and negative scores.

We have two advantages

1) We don't need to sort zero scores

2) Sort two small groups is faster then sort a single big one

Speed up is of about 2%

Because equal scored moves could be reordered in a different way
this is not a "no functional change" although I have verified
the output list is always correctly sorted.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>

No differences found