Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about speed and bitboard

Author: Alessandro Scotti

Date: 01:07:45 09/17/04

Go up one level in this thread


On September 16, 2004 at 21:20:50, Uri Blass wrote:

>What is faster doing a loop on the 1's of a bitboard or doing a loop on array of
>integers
>
>I simply consider to change my knight move generator to bitboards

I don't know what is faster, but when using bitboards there are also other
factors to take into account (i.e. you can usually reduce the number of bits to
consider).

Anyway, the main problem with looping on 1's is that mainstream languages do not
have direct support for this kind of operation, even if it is  available in the
CPU instruction set.

Using a for() loop to find 1's will run *very* slow, but probably still
acceptable. Using a lookup table to get the leading non-zero bit improves
performance of maybe a 2x factor or more (e.g. GNUChess). Using just a bit of
assembly language will probably yield a huge improvement, say 3x or more with
respect to the lookup table. At this point you are also probably running faster
than the loop on integer array. (BTW I could only perform some tests on 32-bit
platforms.)

These are in fact the only few lines of assembly I have in my program. (You can
find code for several platforms in the Crafty sources if needed.)

I'm talking about a good but "quiet" design. When you start to optimize
aggressively things can change a lot and you simply can't compare without taking
 specific implementations into account. I'm sure that there are integer array
programs faster than bitboards and also the other way around...




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.