Author: Matt Taylor
Date: 00:50:03 01/07/03
Go up one level in this thread
On January 07, 2003 at 03:22:02, Russell Reagan wrote:
>On January 07, 2003 at 02:56:31, Matt Taylor wrote:
>
>>If his program does population counts often, he may as well use an assembly
>>routine. He doesn't need to write it himself; others have done that.
>
>Even so, it's not going to amount to a hill of beans as long as he uses one that
>is efficient. Unless it's significantly faster it won't make his program any
>better. Even if it made his program run twice as fast, so what? That's not even
>close to an extra ply unless his program is as good as or better than the best
>commercial programs in the world (IE it would need a branching factor of 2.0).
>And let's be realistic, it's not going to make his program go twice as fast
>anyway, and his program isn't among the world's best.
>
>He would be better off putting in an efficient popcount that he understands, and
>working on his evaluation function or searching methods.
>
>>FYI Crafty's population count and LSB/MSB scan routines are in assembly. Refer
>>to X86.s and vcline.h
>
>I was referring to this, from Crafty, boolean.c, which is the default popcount
>(hince the #else).
>
>#else
>
>int PopCnt(register BITBOARD a) {
> register int c=0;
>
> while(a) {
> c++;
> a &= a - 1;
> }
> return(c);
>}
>
>#endif
Why do you need to understand it? Do you plan on making a bigger, better
popcount later? Keep one around in C for portability, and use the assembly
routine when you can.
It might not give him an extra ply, but the question that warrants asking is,
"Why not?" Is assembly inherently evil? It doesn't limit portability if you do
it correctly, and as the algorithm is already written, it allows him to
concentrate on other issues. No need to reinvent the wheel.
The other point to make is that a fast popcount/whatever will influence design
decisions. If you have a slow one, you avoid using it. I'm not going to imply
that a fast popcount is going to change the entire structure of the program, but
certainly that class of function enables efficient bitboards.
Really though, this is all silly. If someone else has written the optimal
solution, I see no reason to not take it.
-Matt
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.