Author: Russell Reagan
Date: 18:27:08 08/17/02
I was wondering if there is any speed hit in creating a Bitboard class as some
bitboard engines do, as opposed to using the simple C version. For example, in
Resp a Bitboard class is used, and I am not sure if it's a good implementation
(not to imply that it isn't). The author does things like:
class Bitboard {
// ...
public:
FORCEINLINE Bitboard operator &= (const Bitboard& b)
{
bits &= b.bits;
return *this;
}
private:
UINT64 bits;
};
If all goes well and it is inlined, I would assume this would be equivalent to
the C approach. My problem is that I don't know if the class approach will add
any overhead. Will this be any slower than the C approach where there is no
overhead in doing a bitboard &= x; ? I think the main thing that's bothering me
is the return statement. I think it's good in general to return something when
overloading standard operators, but it's not really necessary when using
bitboards, and if it causes a speed hit, a void Bitboard operator &=... might be
better.
For example, in James Swafford's program he has a void return type on his
bitwise operations for his bitboard class, so it makes me wonder...
This is one area that seems like it should be as fast as possible. If it takes
twice as long to do a bitwise operation on a bitboard (in addition to doing
64-bit operations on a 32-bit machine), that's going to add up fairly quick I'd
imagine.
My attempts to test this myself have all failed due to the compiler optimizing
my code away, so the ASM doesn't tell me much :) So...help!
Russell
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.