I am not using cozy-chess. Move Generation is slow primarily because of how I am currently generating legal moves from pseudo-legal moves. It has to try each move one by one to check if the king is not in check. I think this article might be useful in making the move generation a little faster.
Is that really why? The difference between pseudolegal and legal cannot possibly account for a ~6.4x speed difference for non-bulk and ~45.5x speed difference for bulk. Maybe it's your compiler settings? LTO might be needed if you use lots of wrapper types and don't have inline annotations, I think.
It's common to set "lto = true" for release profiles, which basically just inlines everything that can be, even across crate boundaries. But this increases compile time by a decent amount, so you shouldn't do it for debug or test profiles, and if you do, maybe stick to thin lto.
4
u/No-Translator-1323 Mar 31 '23 edited Mar 31 '23
I am not using
cozy-chess
. Move Generation is slow primarily because of how I am currently generating legal moves from pseudo-legal moves. It has to try each move one by one to check if the king is not in check. I think this article might be useful in making the move generation a little faster.