| Crates.io | lperft |
| lib.rs | lperft |
| version | 0.1.0 |
| created_at | 2025-03-29 02:13:37.622006+00 |
| updated_at | 2025-03-29 02:13:37.622006+00 |
| description | A blazingly fast, multithreaded perft tool |
| homepage | |
| repository | https://github.com/HansTibberio/lperft |
| max_upload_size | |
| id | 1610737 |
| size | 34,556 |
lperft is a blazingly fast, multithreaded perft tool designed for command-line use, ideal for debugging chess move generators. It calculates the total number of nodes from a given chess position and outputs a list of all legal moves, along with their respective node counts at the specified depth.
You have several options for installing lperft:
The easiest way to install lperft is by using Cargo, the Rust package manager. In your terminal, run the following command:
cargo install lperft
This will download and compile the latest version of lperft from crates.io.
If you prefer not to compile the program yourself, you can download a precompiled binary from the Releases section of the repository. Simply download the appropriate version for your system and run the binary directly.
If you want to compile lperft natively for your processor, make sure you have Rust installed. Then, you can clone the repository and build the project with the following commands:
git clone https://github.com/HansTibberio/lperft.git
cd lperft
RUSTFLAGS="-C target-cpu=native" cargo build --release
For even better performance, you can enable the bmi2 feature by using the following command to build with this optimization:
RUSTFLAGS="-C target-cpu=native" cargo build --release --features bmi2
With any of these methods, you'll be able to run lperft directly from the command line once the installation or build process is complete.
lperft is executed from the command line as follows:
lperft [OPTIONS] --depth <DEPTH>
To run lperft on the default starting position with a search depth of 7 and use 2 threads:
lperft --depth 7 --threads 2
To analyze a custom position using a FEN string (e.g., a specific position from a game), set the depth to 6, and use a 128MB transposition table:
lperft --fen "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1" --depth 6 --hash 128
-f, --fen <FEN>
Specifies the position in FEN format (enclosed in quotes).
If omitted, the default starting position is used:
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
-d, --depth <DEPTH>
The search depth to evaluate.
-H, --hash <HASH>
The size of the transposition table in megabytes (optional).
If not specified, the search will proceed without a transposition table.
-t, --threads <THREADS>
The number of threads to use for parallel node search.
By default, 1 thread is used.
Below are the benchmarks for lperft, measuring its performance on Perft(7), Perft(8), and Perft(9) from the starting position and the well-known Kiwipete position.
Starting Position Benchmarks
| Depth | Hash (MB) | Threads | Time | NPS |
|---|---|---|---|---|
| 7 | 0 | 1 | 5.052 s | 632,580,821 |
| 7 | 0 | 2 | 2.606 s | 1,226,088,379 |
| 7 | 64 | 1 | 1.655 s | 1,930,084,154 |
| 7 | 128 | 1 | 1.620 s | 1,972,545,265 |
| 7 | 64 | 2 | 845 ms | 3,780,542,314 |
| 7 | 128 | 2 | 825 ms | 3,870,346,038 |
| 8 | 1024 | 8 | 4.087 s | 20,794,666,969 |
| 8 | 1024 | 12 | 3.192 s | 26,624,967,590 |
| 9 | 8192 | 12 | 37.560 s | 64,949,336,635 |
Kiwipete Benchmarks
| Depth | Hash (MB) | Threads | Time | NPS |
|---|---|---|---|---|
| 7 | 4096 | 12 | 10.294 s | 36,348,767,805 |
| 8 | 8192 | 12 | 247.768 s | 62,533,872,605 |
Test system: AMD Ryzen 5 5600G (3.9 GHz), 32 GB DDR4 3200 MHz, Windows 10
This project is licensed under GPLv3. See the LICENSE file for details.