Author: Dann Corbit
Date: 15:18:43 06/07/01
Go up one level in this thread
On June 07, 2001 at 13:47:55, Miguel A. Ballicora wrote:
[snip]
>Personally, after I saw a suggestion on the net, I try to code those cases
>(if it is not in a bottleneck or I do not know yet)
>as
>
> tsq = B->BlackKnights;
> if (side == WHITE)
> tsq = B->WhiteKnights;
I know some folks don't like it, but I prefer this:
tsq = (side == WHITE) ? B->WhiteKnights : B->BlackKnights;
There is a massive penalty for a missed branch prediction. If a branch turned
out to be a bottleneck, there are easy enough ways to detect and fix them.
LazyEval() and Search() are the two hotspots in our program, with the lion's
share of the time going to the loop that starts out:
------------------------------------------------------------------------
291 1119 while (pieces) {
292 8109 sq = FirstPiece(pieces);
293 4723 p = B->pieces[sq];
294
295 #ifdef DEBUG_EVAL
296 PrintPiece(p);
297 #endif
298 /* Score for this piece */
299 4204 switch (p) {
------------------------------------------------------------------------
in LazyEval(). The calls to FirstPiece() gobble up the bulk of the time, but I
don't see how I could speed up the inline assembly routine that is currently
being used. I was wondering about having a piece list, but snagging a single
bit from a 64 bit integer seems like it should be at least as efficient. Maybe
if we kept a piece list for each type, we could avoid the switch, which would
save some time.
and with a big chunk going to the block starting:
------------------------------------------------------------------------
01:26EF 538 5601 " SortFrom(Full, Moveno, NMoves);"
01:27E4 539 36 m = Full[Moveno].move;
540
541 " /* Get the piece that's moving, and the piece on the target
square */"
01:27EB 542 492 p = PType(B->pieces[MFrom(m)]);
01:280D 543 271 pto = PType(B->pieces[MTo(m)]);
544
545 /* Do the move */
01:2832 546 143 " U = DoMove(B, m);"
547
548 /* Filter out illegal moves. If we're in check then this has
already
549 * been done. */
01:2843 550 2808 " if (!inchk && InCheck(B, Opponent(B->side))) {"
------------------------------------------------------------------------
in Search().
SortFrom() is especially expensive here.
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.