jordanbray / chess

A rust library to manage chess move generation
https://jordanbray.github.io/chess/
MIT License
231 stars 54 forks source link

Benchmark against Pleco? #29

Closed yukw777 closed 4 years ago

yukw777 commented 4 years ago

I'm planning on writing a chess engine in rust myself, and looking for a move generator to use for it. I've narrowed it down to your library and Pleco. Do you have any benchmarks between them? Looking at this benchmark result (https://github.com/niklasf/shakmaty#benchmarks), it seems like yours is a lot faster than Stockfish, and since Pleco is a clone of Stockfish, I'm assuming yours is also faster than Pleco? Thanks for your help in advance!

jordanbray commented 4 years ago

I've performed a quick benchmark of pleco with chess_perft binary I wrote. Pleco does seem quite a bit slower than either shakmaty or this library (about a factor of 2.5 - depends on the position).

I'll do a more thorough analysis and update the chess_perft crate, with some graphs and whatnot.

Additionally, take a look at the chess_uci crate I wrote if you get a chance: https://github.com/jordanbray/chess_uci. It's not published on crates.io yet, but I hope to get it into a stable state soonish. My goal there is to deal with the uci protocol details and allow you to focus on the engine itself. Most of the pieces are there and it may make your life easier, if for nothing else than all the string parsing.

jordanbray commented 4 years ago

Closing this in favor of https://github.com/jordanbray/chess_perft/issues/1. This is where I keep the benchmarking code.

jordanbray commented 4 years ago

One other thing, make sure to enable opt-level = 3 in your Cargo.toml when using this crate because rust does a really bad job of generating code without optimizations. A small performance boost can also be achieved with RUSTFLAGS="-C target-cpu=native" which allows the use of some bitwise instructions.

yukw777 commented 4 years ago

Thanks for the quick and detailed response! I really appreciate it. I'll be using chess for my engine. :) Also thanks for pointing me to your uci library! I'll definitely take a look at it, too.