Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: NPS Tree Walk

Author: Zach Wegner

Date: 19:17:21 05/04/03

Go up one level in this thread


>I did a profile (for a minmax walk depth=3), im using a 0x88 board, i try to
>program with alot of "modules", that means i have small functions for almost
>everything. The function get_piece is called approx 300times/node, which seems
>resonable, on_board is the !(square & 0x88) test.
>
>Flat profile:
>
>Each sample counts as 0.01 seconds.
>  %   cumulative   self              self     total
> time   seconds   seconds    calls   s/call   s/call  name
> 11.74      1.20     1.20 29440891     0.00     0.00  get_piece
> 10.18      2.24     1.04 31783554     0.00     0.00  on_board
>  7.83      3.04     0.80    97862     0.00     0.00  eval
>  7.24      3.78     0.74   777565     0.00     0.00  move_pawn
>  7.14      4.51     0.73   497315     0.00     0.00  move_pieces
>  6.85      5.21     0.70   427282     0.00     0.00  not_in_check
>  6.75      5.90     0.69   100361     0.00     0.00  move_generator
>  5.77      6.49     0.59  7291134     0.00     0.00  is_different
>  3.91      6.89     0.40 10203170     0.00     0.00  is_empty
>  3.42      7.24     0.35   100360     0.00     0.00  all_moves_legal
>  3.33      7.58     0.34  7898776     0.00     0.00  getbits
>  3.03      7.89     0.31  3471247     0.00     0.00  new_move
>  2.74      8.17     0.28  4652405     0.00     0.00  is_null_move
>  2.64      8.44     0.27   196244     0.00     0.00  move_knight
>  2.25      8.67     0.23  4349648     0.00     0.00  legal_move
>  2.05      8.88     0.21  4449597     0.00     0.00  look
>  1.66      9.05     0.17   100361     0.00     0.00  move_king
>  1.47      9.20     0.15  2170466     0.00     0.00  is_white_piece
>  1.37      9.34     0.14  4265234     0.00     0.00  add_move
>  1.27      9.47     0.13  3021733     0.00     0.00  getBoard
>  0.98      9.57     0.10   786271     0.00     0.00  score_cap
>  0.88      9.66     0.09  2796571     0.00     0.00  hist_score2
>  0.88      9.75     0.09  2796571     0.00     0.00  set_move_score
>  0.88      9.84     0.09   100360     0.00     0.00  undo_move
>  0.78      9.92     0.08  1035659     0.00     0.00  is_black_piece
>  0.68      9.99     0.07   100360     0.00     0.00  do_move

I see that you have way too many functions. It is not a bottleneck, as long as
they are inlined or macros. What I also see is that your move_generator count is
greater than your node count, so I guess you are regenerating moves after every
undo_move. This is your source of trouble, I guarantee it. You need to (1) make
a local list of moves that is passed to the move_generator, e.g.

void search(int depth  etc.)
{
int movecount;
MOVE movelist[MAXMOVES];
...
genrate_moves(&movelist, &movecount);
for (x = 0; x < movecount; x++)
...
}

or (2) make a global list organized by ply as in TSCP.



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.