Note that the qperft.c that is posted on my website does NOT make/unmake the final ply (except for King moves, to test legality) and does not even count the moves one by one, but just computes the total from the size of the move stack.Michael Sherwin wrote:I am not sure that the 3400+ which, is determined by benchmarks, extends well to chess programming. However, your numbers are also very impressive! I think that I have downloaded your special perft code, so I will take a look at it.
I now also posted the version used above, that counts the moves one by one after having made them, (and tested them for legality where needed), so that it really can determine on a move by move basis which moves are captures, promotions etc.
They use the same move generator. (Which was later incorporated into Joker.)
Actually, I think that the perfting using the 'perft trick' is more relevant for the performance of a chess engine, as chess engines usually do not make and unmake the last move if they don't also generate moves in the position they lead to. If a stand-pat was possible, futility pruning usually takes care of it before the move is made. So perfts that make and unmake the last ply put way to much emphasis on the speed of make/unmake, compared to the move generation itself.
Removing the move-type counting, only counting totals, (but still on a move by move basis), reduces the perft(7) time from 199 sec to 125 sec! (Yes, there are difficult-to-predict if-statements there, to figure out which moves are captures, promotions, etc. That hurts on a P4.)
With the bulk-counting trick, perft(7) takes only 52 sec. (This can only calculate totals.) This was the code you saw before. Now I just used an earlier version.
Code: Select all
$ ./qperft 7
- - - - - - - - - - - -
- - - - - - - - - - - -
- - r n b q k b n r - -
- - p p p p p p p p - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - P P P P P P P P - -
- - R N B Q K B N R - -
- - - - - - - - - - - -
- - - - - - - - - - - -
Quick Perft by H.G. Muller
Perft mode: No hashing, bulk counting in horizon nodes
perft(1)= 20 ( 0.000 sec)
perft(2)= 400 ( 0.000 sec)
perft(3)= 8902 ( 0.000 sec)
perft(4)= 197281 ( 0.000 sec)
perft(5)= 4865609 ( 0.078 sec)
perft(6)= 119060324 ( 2.047 sec)
perft(7)= 3195901860 (52.703 sec)