A comparison of some Perft programs 

Discussion of chess software programming and technical issues.

Moderator: Ras

Sopel
Posts: 400
Joined: Tue Oct 08, 2019 11:39 pm
Full name: Tomasz Sobczyk

Re: A comparison of some Perft programs 

Post by Sopel »

phhnguyen wrote: Mon Jan 12, 2026 11:30 am
Sopel wrote: Sun Jan 11, 2026 9:42 pm FWIW on 7800x3d on windows I get ~300Mnps for SF 17.1 and 1650Mnps for gigantua on perft 7
Your information is ambiguous to me. SF doesn't print out both elapsed and speed when computing Perft. How can you get the speed of 300 Mbps? If it is the speed of normal search, we cannot use it to compare with Gigantua since (AFAK) it uses leave nodes from bulk counting, but not nodes by making/undoing to calculate Perft speed.

The best if you could do, please measure the time for calculating Perft 8 for both programs. SF doesn't print out elapsed, but you can easily add a few commands to SF code (e.g., such as: TimePoint startPoint = now();... elapsed = now() - startPoint;), recompile and run. You may find a 3rd party program to run it for timing, too. For Gigantua, you can download its 64-bit exe file from its GitHub and run it as below. It will calculate elapsed time itself:

Code: Select all

Gigantua.exe "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" 8
FYI: I have just re-run some Perft programs from my PC after resetting. There is no chance for Gigantua on my old PC: it is still lagging behind SF. Hope it performs better on your PC.
time can be measured by outside forces, and I can do division
dangi12012 wrote:No one wants to touch anything you have posted. That proves you now have negative reputations since everyone knows already you are a forum troll.

Maybe you copied your stockfish commits from someone else too?
I will look into that.
abulmo2
Posts: 493
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: A comparison of some Perft programs 

Post by abulmo2 »

phhnguyen wrote: Mon Jan 12, 2026 11:03 am
petero2 wrote: Sun Jan 11, 2026 8:51 pm
phhnguyen wrote: Sat Jan 10, 2026 11:25 pm 7) MPerft by Richard Delorme
https://github.com/abulmo/MPerft

The project was updated 6 years ago. I downloaded and compiled it via the make command.

It is the fastest and significantly faster than other programs in this comparison, 17 times faster than Stockfish. On the screen, it prints clearly that it uses hashing and multithreading.
Are you sure it is using multithreading? On my computer it says it is using hashing and bulk counting, but it doesn't say anything about multiple threads, and only uses one thread. Also looking at the source code I see nothing about threads in it.
You are right! It is my mistake! MPerft uses bulk counting and hashing only!
I fixed this in version 3.0. Now mperft uses also multithreading. On my old ryzen 9 5950:

Code: Select all

$ mperft-3.0-x86-64-v3 -d 8 -b -h 256 -t 32 -q
perft  8 :     84998978956 leaves in      0.553 s 153729146951 leaves/s
Richard Delorme
abulmo2
Posts: 493
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: A comparison of some Perft programs 

Post by abulmo2 »

phhnguyen wrote: Mon Jan 12, 2026 10:59 am
hgm wrote: Sun Jan 11, 2026 11:46 am The key to doing fast perfts seems to be hashing.
Agreed. Hashing is one of the largest gain methods for Perft.

However, from my experience as well as reading somewhere, hashing may give a factor of about 2 times speed. My computer has 8 cores, and multithreading could bring me a factor of 8 times faster :D
With the latest MPerft that implement multithreading, I got this on an AMD Ryzen 9 5950x.
  • bulk counting: x10
  • multithreading with 16 threads: x14
  • transposition table of 256Mbytes (16M entries): x17
Richard Delorme
ankan
Posts: 78
Joined: Sun Apr 21, 2013 3:29 pm
Full name: Ankan Banerjee

Re: A comparison of some Perft programs 

Post by ankan »

Hello perft fans,

I’m posting on this forum after almost a decade. I haven’t had much time to spend on chess lately, but recent advances in AI coding agents have completely changed the game for hobby projects like this.

I pointed the agents at my old codebase and asked them to:
- analyze the implementation,
- experiment with optimization ideas,
- benchmark and profile different approaches,
- incorporate some ideas I had never gotten around to trying myself,
- and iterate repeatedly on improvements.
After dozens of iterations, the result is a >2× speedup over the old code — code that I was actually quite proud of back then.
Funny enough, I haven’t even gone through all the details of the updated implementation yet, so I’m a little conflicted about whether this is still “fun” anymore :)

Here are the updated versions of my CPU and GPU perft programs:
GPU: https://github.com/ankan-ban/perft_gpu_2026
CPU: https://github.com/ankan-ban/perft_cpu_2026

Features:
- TT OFF and TT ON modes
- Single-threaded and multi-threaded CPU versions
- Bulk counting at leaf nodes across all variants
The CPU TT path probably still has a lot of room for improvement — I haven’t tuned it yet.

Some interesting results:

Without TT (Kiwipete position — single-threaded: depth 5, multi-threaded/GPU: depth 7)

Code: Select all

* Apple M4 CPU
      ~2.9 billion NPS single-threaded
      ~17.3 billion NPS with 10 threads
* Intel Core Ultra 7 270K CPU
      ~2.6 billion NPS single-threaded
      ~50.2 billion NPS with 24 threads
* RTX 4090 GPU
      ~1,308 billion NPS
* RTX Pro 6000 Blackwell
      ~2,110 billion NPS
With TT (start position), RTX Pro 6000 Blackwell (96 GB VRAM + 96 GB system memory)

Code: Select all

* Perft 10 in ~2 seconds
* Perft 13 in ~1 hour 34 minutes
syzygy
Posts: 5986
Joined: Tue Feb 28, 2012 11:56 pm

Re: A comparison of some Perft programs 

Post by syzygy »

ankan wrote: Fri May 15, 2026 7:14 am I’m posting on this forum after almost a decade. I haven’t had much time to spend on chess lately, but recent advances in AI coding agents have completely changed the game for hobby projects like this.

I pointed the agents at my old codebase and asked them to:
- analyze the implementation,
- experiment with optimization ideas,
- benchmark and profile different approaches,
- incorporate some ideas I had never gotten around to trying myself,
- and iterate repeatedly on improvements.
After dozens of iterations, the result is a >2× speedup over the old code — code that I was actually quite proud of back then.
Funny enough, I haven’t even gone through all the details of the updated implementation yet, so I’m a little conflicted about whether this is still “fun” anymore :)
It's crazy.... :lol:
smatovic
Posts: 3732
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: A comparison of some Perft programs 

Post by smatovic »

syzygy wrote: Sat May 16, 2026 12:53 am
ankan wrote: Fri May 15, 2026 7:14 am I’m posting on this forum after almost a decade. I haven’t had much time to spend on chess lately, but recent advances in AI coding agents have completely changed the game for hobby projects like this.

I pointed the agents at my old codebase and asked them to:
- analyze the implementation,
- experiment with optimization ideas,
- benchmark and profile different approaches,
- incorporate some ideas I had never gotten around to trying myself,
- and iterate repeatedly on improvements.
After dozens of iterations, the result is a >2× speedup over the old code — code that I was actually quite proud of back then.
Funny enough, I haven’t even gone through all the details of the updated implementation yet, so I’m a little conflicted about whether this is still “fun” anymore :)
It's crazy.... :lol:
Yes :) I do consider Ankan as top GPU chess programmer, if the AI agents are able to speed up his codebase 2 fold, then we must have passed some kind of inflection point with generative AI...

--
Srdja