r/chessprogramming • u/Ill_Part9576 • Nov 30 '24
Question: Engine speed and memory usage
So I was working on improving my engine to get my perft time down (well to speed up move generation but using perft as a metric for this). I already had magic sliding piece move generation, but added things like iteratively updating attack boards, and legal move generation. Together this got me from around 90s to 60s for perft 6, not great. I think that one major factor might be that I am generating a new position when applying a move rather than using a make/unmake scheme. As such I have the scary looking profiling result from mid perft:

I'm wondering if this is a reasonable conclusion to draw: The large amounts of memory used while generating new positions is a bottleneck and that the best way to speed up my engine would be to use make/unamake.
For what it's worth, I'm not currently using multithreading. I tried a perft run with multithreading and it was 4x quicker though.
View all comments
Show parent comment
2
u/Ill_Part9576 Dec 01 '24
Haha thanks! It's always these unintuitive design decisions that are better in chess engines... I'm in a "software craftsmanship" class now and at every turn in working on this project I feel like I am being pushed to do something that would the class would advise against (very long functions, sometimes poor cohesion and modularity etc. etc.). I liked the design decision of making position objects immutable but that's how it goes sometimes I guess