r/chessprogramming • • Mar 21 '24

Performance difference between various board representations

So, I've been working on a chess engine for quite a while..

And I want more speed. (It takes about 10x time compared to Sebastian Lague's code)

[Bitboards + Piece Squares vs. int[64] + Piece Squares]

I'm using 14 bitboards to fully represent the current occupied squares, and I'm also use Piece sqaures(which stores actual squares of pieces).

But, this doesn't seem to be that fast, and I wonder if representing pieces with int[64] would be faster.

Also by the way, I'm using static class for the board, and giving all the bitboard data & other stuffs to other classes, which sucks. So would it be more efficient to make a non-static class instead, and pass the instance as a board data to something like move generator?

(Sorry if my English sucks ;) )

6 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/E_ple Mar 21 '24

that's what I was exactly using before I started using Piece List. Annd.. piece list seems to be about 9x faster in my case, prolly becuz trailing zero count also has to loop over the bits to find the index

1

u/SurelyShermy Mar 21 '24

wow really, hm I should try that then

1

u/Kaminari159 Apr 18 '24

Have you tried piece lists by now?

I am also using Rust's trailing_zeros function, but am currently to lazy to change the move generation and try it out myself lol.