Algorithm for mate recognition

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: Algorithm for mate recognition

Post by jwes »

Fulvio wrote:
jwes wrote:I think after this, you would need to look at ASCII conversion and overlapped I/O to speed it up significantly.
ASCII conversion takes 12,69% of the time and fwrite 8,47%.

Thanks for your suggestions, I will test them.
However the atks array will be very huge: 20 bytes * 64 * 64 = 80kB

I suspect that all the cache misses will hurt performance.
If they do, you can easily reduce the cache hit to ~16kB by shifting the masks. You need 5 bits for a mask index and six bits shift count for each mask so you could fit each entry in 4 bytes. Also less than half the entries will ever be accessed which should reduce cache pressure. With some clever bit-twiddling you could calculate the masks on the fly and reduce cache pressure to almost nothing.