Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: NPS Tree Walk

Author: Angrim

Date: 02:53:36 05/05/03

Go up one level in this thread


On May 03, 2003 at 08:07:31, Magoo wrote:

>On May 03, 2003 at 02:47:29, Tony Werten wrote:
>
>>On May 02, 2003 at 22:05:25, Magoo wrote:
>>
>>>How bad is this:
>>>Depth:3, Nodes:99949, Time:40 sec, Nps:2498
>>
>>Horrible, sorry.
>>
>>From the speed you get (Nps) I guess you are doing too much/ doing things
>>double. My program is not fast, but still 100x times faster.
>>
>>Profiling your code should show up where the problems are. You could also post
>>the structure of your program here, we might be able to help.
>>
>>Good luck,
>>
>>Tony
>
>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
>.

Based on my experience with profiling, the only way that all
those tiny little functions would show up in the profile is if
they are not being inlined.  If you are using gcc, you either need
to use the "inline" keyword before each of the tiny functions
combined with passing -O to the compiler, or pass -O3 to the compiler
and it will guess which functions to inline for you.

Angrim



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.