Perft

Discussion about development of draughts in the time of computer and Internet.
Post Reply
Joost Buijs
Posts: 490
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Perft

Post by Joost Buijs »

Tim Vermeulen wrote: Wed Sep 21, 2022 17:32 If I understand correctly, all these results are without reusing intermediate results of transpositions? Would that be considered cheating for this exercise?
This is just to determine the correctness of the move-generator and to see how fast the move-gen/move-make logic is. In this case I think that Bert is using bulk-counting at the leaves, otherwise it would not be so fast.

Of course it is possible to make Perft() run faster by adding a hash-table and making it multi-threading, it wouldn't be cheating but this is not the aim here.

With a hash-table the speed (moves/sec.) will likely go down but the tree will get smaller and you will get the result faster.
Tim Vermeulen
Posts: 4
Joined: Sun Dec 18, 2011 20:58
Real name: Tim Vermeulen

Re: Perft

Post by Tim Vermeulen »

Understandable! On chess forums I sometimes see people post perft results with and without caching, I guess it depends on what you want to measure exactly.
Joost Buijs
Posts: 490
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Perft

Post by Joost Buijs »

On my new PC with AMD Zen5 Threadripper single threaded perft() does pretty good too:

Code: Select all

Ares-AI-v2.x welcomes you!

initializing:
zobrist numbers: 1C0C5121 ok
magic tables: 1D990E8A ok

    b  b  b  b  b
  b  b  b  b  b
    b  b  b  b  b
  b  b  b  b  b
    .  .  .  .  .
  .  .  .  .  .
    w  w  w  w  w
  w  w  w  w  w
    w  w  w  w  w
  w  w  w  w  w

stm: White
fen: W:W31-50:B1-20
hash: 9A28317B5F70403C

perft( 1)  nodes            9  time   0.0000  Kn/s  90000
perft( 2)  nodes           81  time   0.0000  Kn/s  47647
perft( 3)  nodes          658  time   0.0000  Kn/s 212258
perft( 4)  nodes         4265  time   0.0000  Kn/s 568667
perft( 5)  nodes        27117  time   0.0001  Kn/s 525523
perft( 6)  nodes       167140  time   0.0003  Kn/s 610669
perft( 7)  nodes      1049442  time   0.0018  Kn/s 580123
perft( 8)  nodes      6483961  time   0.0106  Kn/s 612128
perft( 9)  nodes     41022423  time   0.0698  Kn/s 587876
perft(10)  nodes    258895763  time   0.3989  Kn/s 649083
perft(11)  nodes   1665861398  time   2.7263  Kn/s 611032

    .  .  .  .  .
  w  .  .  w  w
    w  .  .  .  .
  .  B  .  .  w
    w  w  w  B  .
  .  .  .  .  w
    W  .  w  .  .
  .  w  .  .  .
    w  w  w  w  .
  w  .  .  .  .

stm: Black
fen: B:W6,9-11,20-23,30,K31,33,37,41-44,46:BK17,K24
hash: C82BAE92DF8C021F

perft( 1)  nodes           14  time   0.0000  Kn/s    711
perft( 2)  nodes           55  time   0.0000  Kn/s   7432
perft( 3)  nodes         1168  time   0.0000  Kn/s 119184
perft( 4)  nodes         5432  time   0.0000  Kn/s 169750
perft( 5)  nodes        87195  time   0.0002  Kn/s 570275
perft( 6)  nodes       629010  time   0.0010  Kn/s 601923
perft( 7)  nodes      9041010  time   0.0105  Kn/s 858204
perft( 8)  nodes     86724219  time   0.1087  Kn/s 798077
perft( 9)  nodes   1216917193  time   1.4321  Kn/s 849761

    .  .  .  .  .
  .  .  .  .  .
    .  b  b  b  .
  b  .  b  b  .
    b  .  b  b  w
  b  w  w  .  w
    .  w  w  w  w
  .  w  w  .  .
    .  .  .  .  .
  .  .  .  .  .

stm: White
fen: W:W25,27-28,30,32-35,37-38:B12-14,16,18-19,21,23-24,26
hash: 93280D47168824D4

perft( 1)  nodes            6  time   0.0000  Kn/s  60000
perft( 2)  nodes           12  time   0.0000  Kn/s  17143
perft( 3)  nodes           30  time   0.0000  Kn/s  25000
perft( 4)  nodes           73  time   0.0000  Kn/s  38421
perft( 5)  nodes          215  time   0.0000  Kn/s  56579
perft( 6)  nodes          590  time   0.0000  Kn/s  67045
perft( 7)  nodes         1944  time   0.0000  Kn/s  91268
perft( 8)  nodes         6269  time   0.0001  Kn/s  91786
perft( 9)  nodes        22369  time   0.0002  Kn/s 116445
perft(10)  nodes        88050  time   0.0006  Kn/s 146093
perft(11)  nodes       377436  time   0.0021  Kn/s 177483
perft(12)  nodes      1910989  time   0.0084  Kn/s 228232
perft(13)  nodes      9872645  time   0.0382  Kn/s 258499
perft(14)  nodes     58360286  time   0.1911  Kn/s 305379
perft(15)  nodes    346184885  time   1.0838  Kn/s 319407
I wonder when the time will come one can do > 1 billion nodes per second, probably within a few years from now.
BertTuyt
Posts: 1613
Joined: Wed Sep 01, 2004 19:42

Re: Perft

Post by BertTuyt »

Joost, nice result!
When Ed published his first perft result (initial position) in 2008, the time was 55.86 seconds.
Joost Buijs
Posts: 490
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Perft

Post by Joost Buijs »

That's about 20 times faster.

I don't think that processors got 20 times faster the last 17 years, it's a combination of many things, faster memory, wider buses and better compilers to name a few.

With a move-generator/move-do/undo optimized for perft() it could even be faster, Ares uses the same routines for perft() as it does for it's regular search, the only thing I switched off is the Zobrist hash-calculation because this is not needed.

The memory-clock of the Threadripper is still at the default 2400 MHz. (4800 MT/s), the Threadripper supports memory running at 3200 MHz., and I have memory specified to run at 3200 MHz., to use it at this speed I have to increase the memory-voltage from 1.1V to 1.4V, and that's is something I don't like.
BertTuyt
Posts: 1613
Joined: Wed Sep 01, 2004 19:42

Re: Perft

Post by BertTuyt »

The perft result from Ed was (most likely) without bulk-counting, which should not be neglected.
Ed Gilbert
Posts: 864
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Perft

Post by Ed Gilbert »

My newest PC is a laptop with an I7-12700H CPU. Base clock is 2.4 GHz, but it gets up to about 4.5 GHz with turbo boost.

perft(1) 9 nodes, 0.00 sec, 9 knodes/sec
perft(2) 81 nodes, 0.00 sec, 81 knodes/sec
perft(3) 658 nodes, 0.00 sec, 658 knodes/sec
perft(4) 4265 nodes, 0.00 sec, 4265 knodes/sec
perft(5) 27117 nodes, 0.00 sec, 27117 knodes/sec
perft(6) 167140 nodes, 0.00 sec, 83570 knodes/sec
perft(7) 1049442 nodes, 0.01 sec, 174907 knodes/sec
perft(8) 6483961 nodes, 0.02 sec, 270165 knodes/sec
perft(9) 41022423 nodes, 0.15 sec, 266379 knodes/sec
perft(10) 258895763 nodes, 0.90 sec, 288624 knodes/sec
perft(11) 1665861398 nodes, 5.68 sec, 293492 knodes/sec

Less than half the speed of your new machine.
Ed Gilbert
Posts: 864
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Perft

Post by Ed Gilbert »

BertTuyt wrote: Sun Sep 21, 2025 14:55 The perft result from Ed was (most likely) without bulk-counting, which should not be neglected.
I looked at some old commits in SVN. Bulk counting was added on July 17, 2008.
BertTuyt
Posts: 1613
Joined: Wed Sep 01, 2004 19:42

Re: Perft

Post by BertTuyt »

Ed, you are right with bulk-counting the result for the initial positions is 32.8 seconds.
Joost Buijs
Posts: 490
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Perft

Post by Joost Buijs »

Ed Gilbert wrote: Sun Sep 21, 2025 14:58 My newest PC is a laptop with an I7-12700H CPU. Base clock is 2.4 GHz, but it gets up to about 4.5 GHz with turbo boost.

perft(1) 9 nodes, 0.00 sec, 9 knodes/sec
perft(2) 81 nodes, 0.00 sec, 81 knodes/sec
perft(3) 658 nodes, 0.00 sec, 658 knodes/sec
perft(4) 4265 nodes, 0.00 sec, 4265 knodes/sec
perft(5) 27117 nodes, 0.00 sec, 27117 knodes/sec
perft(6) 167140 nodes, 0.00 sec, 83570 knodes/sec
perft(7) 1049442 nodes, 0.01 sec, 174907 knodes/sec
perft(8) 6483961 nodes, 0.02 sec, 270165 knodes/sec
perft(9) 41022423 nodes, 0.15 sec, 266379 knodes/sec
perft(10) 258895763 nodes, 0.90 sec, 288624 knodes/sec
perft(11) 1665861398 nodes, 5.68 sec, 293492 knodes/sec

Less than half the speed of your new machine.
I use the latest Intel C++ compiler 2025.2.1 (which is free now), this really makes a difference, even for AMD processors it has much better optimization than the C++ compiler from Microsoft.

The 2nd position (with kings) runs so fast because I still use magic multiplication for the king move-generator. Neural networks are so slow that it doesn't matter how fast the move-generator is, maybe using magics is a bit overdone.

The Threadripper 9960X has a base clock of 4,2 GHz., it boosts (on my Asus Pro WS TRX50 mainboard) to 5,45 GHz. which is slightly above specs.
BertTuyt
Posts: 1613
Joined: Wed Sep 01, 2004 19:42

Re: Perft

Post by BertTuyt »

There are rumors that the ZEN 6 will have a boost clock above 6 GHz, so also this record will not be for eternity.
Joost Buijs
Posts: 490
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Perft

Post by Joost Buijs »

BertTuyt wrote: Sun Sep 21, 2025 17:17 There are rumors that the ZEN 6 will have a boost clock above 6 GHz, so also this record will not be for eternity.
I agree, in the future there will still be some improvement in clock-speed and the size of processor caches. Maybe (when I'm lucky) AMD will retain the current processor-socket for the Zen6, this would make it possible to swap processors (like they did with Zen4 and Zen5).

Hopefully I can use my new PC for another 5 years, when I'm 78 I don't expect to do much programming anymore.
Post Reply