Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: BitBoard flop

Author: Tijs van Dam

Date: 03:36:55 02/03/00

Go up one level in this thread


On February 02, 2000 at 21:57:27, Michael Neish wrote:

>
>Excuse me if I gripe.  I just spent two months converting my program to
>bitboards and when I finally removed all the obvious bugs I find it's searching
>about 30% slower than the original routine, which just used simple arrays and
>loops to generate moves, a la TCSP.
>
>So where does the magic of bitboards come alive?  It's certainly not in my case.
>
>Cheers,
>
>Mike.

For me, the big change came when, instead of

inline int CountOnes(BitBoard b)
{
   int n=0;
   while(b)
   {
      if(b&1)n++;
      b>>=1;
   }
   return n;
}

I wrote:

inline int CountOnes(BitBoard b)
{
   register int i=0;
   while(b)
   {
      i++;
      b&=b-1;		// b &= b-1   clears least significant bit
   }
   return i;
}


I use a few CountOnes in the evaluation function. Speed increased almost 300%!
The calculation methods and update routines are VERY important...

Grts
Tijs



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.