]> git.sesse.net Git - stockfish/commit
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)
commit55b5b03273e9740b63663ee84a17788c5424eec3
tree13cbe0bb87b2765d2f6a3ae1e3f04fb826f772c0
parent850c021f868653d9ed51cd0ef5f2a50004d986bd
Speed up sorting of non-captures

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>
src/move.h