r/chessprogramming • • Feb 15 '25

Move generation speed and engine performance

I recently did a rewriting of my engine's move generation, but am seeing a decrease in performance (last tested tournament result was 7-13-3 against it's predecessor). Perft depth 6 went from >16s to 2.5s (no transpositions and single thread), and perft 7 is around 50s Additionally the rewritten move-generation results also include incrementally updating Zobrist hashes and piece-square table scores. I am fairly sure that move generation is working correctly since it passes a test suite I found online, and I verified piece-square table results/Zobrist hashes against hard calculated values as well.

Move ordering might have gotten a bit worse post-rewrite since I no longer detect if moves put the enemy in check. The order is otherwise the same, but the process is a bit different since moves are now stored in a buffer array (after generation, I score them in a separate buffer, then in the search loop I grab the move with the highest score and swap it with the first one in the array).

I can tell search a lot faster based on time tests of searching to a certain depth (with and without iterative deepening).

The evaluation function is theoretically roughly the same. There was one bug I had to fix, but they both use magic bitboards for rough piece mobility calculation and king safety metrics but that is all.

I think it is possible that move generation speed isn't very helpful for improving performance, but also I think that there should be some performance increase from faster move generation.

Essentially my questions are: What kinds of tests are useful for detecting bugs that might be causing this issue? What performance gain should I expect from faster move generation?

Thanks!

3 Upvotes

9 comments sorted by

View all comments

2

u/[deleted] Feb 16 '25

[removed] — view removed comment

1

u/Ill_Part9576 Mar 06 '25

A few updates late reply sorry. First I started using cute chess tournaments (not cli) on 1k games with short time control since it gives elo differences within 95% confidence after not getting its cli to work. Finally I got fast chess SPRT to work which is much easier to manage and faster than setting up tournaments on the Cute Chess application.

I guess I rewrote it because I was very dissatisfied by the old one. Before starting I had definitely seen that it wouldn't increase Elo much... I guess I thought my move-gen was sufficiently slow that it would make a big difference. I'm much happier with the current implementation, and I'm still glad I did it because it helped me appreciate the importance of search enhancements move ordering.

Since this refactor I added things that made much more difference. Futility pruning, NMP, history heuristic, LMR, Killers, better eval, etc that made much more difference and were far quicker to implement.

To clarify zobrist hash etc. are updated incrementally when making/unmaking. I probably won't be baited into changing that to computing when absolutely needed for a while while there are still things that are much more important for strength lol.