Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Perft 5

Author: Magoo

Date: 06:15:59 05/07/03

Go up one level in this thread


On May 07, 2003 at 05:08:43, Uri Blass wrote:

>On May 07, 2003 at 04:57:03, Magoo wrote:
>
>>On May 07, 2003 at 03:56:33, Tim Foden wrote:
>>
>>>On May 06, 2003 at 19:24:23, Magoo wrote:
>>>
>>>>After making alot of functions to macros and alot of other stuff, my program is
>>>>much faster!!
>>>>Perft 5 (without evaluating nodes) gives:
>>>>Depth:5, Nodes:5072212, Time:63 sec, Nps:80511, Value:0
>>>>
>>>>But!! I know other programs (i been looking at mscp and faile) do this
>>>>at least 6 times faster, (that is perft 5 < 10sec).
>>>>I've looked at the source for the programs i compare with, especially faile does
>>>>alot of stuff in the move_generator, mine is smaller, maybe a few more if
>>>>statments.
>>>>Now, if i only could figure out why it is so slow, it shouldn't be!!
>>>>
>>>>Flat profile:
>>>>
>>>>Each sample counts as 0.01 seconds.
>>>>  %   cumulative   self              self     total
>>>> time   seconds   seconds    calls   s/call   s/call  name
>>>> 66.51     42.12    42.12  5087588     0.00     0.00  move_generator
>>>
>>>>  3.65     56.68     2.31  5087587     0.00     0.00  undo_move
>>>>  3.21     58.71     2.03  5087587     0.00     0.00  do_move
>>>
>>>Does your move generate generate all moves in a position in one go, or do you
>>>only generate one move at a time?
>>>
>>>If you are generating all moves in one go, then it looks like you are calling
>>>your movegen in the leaf nodes.  You really should have much fewer calls to your
>>>movegen than to your make/unmake move routines.
>>>
>>>Cheers, Tim.
>>
>>Yes, i do call move_generator in the leaf nodes, i have no better way to check
>>if a move is legal... i look at the moves generated and look for "YxK", that is
>>a move where the king is captured, then i just return -INFINITY and decrease the
>>node count..
>
>You have better ways to do it.
>
>You do not need to generate all moves only to
>check if the king can be captured.
>
>You should only check if the opponent of that king has pieces in the relevant
>squares.
>
>If the white king is at e1 you need only to look at every direction to check if
>there is check from that direction.
>
>For example if you see
>e2 white pawn then you know no check from that direction
>
>Uri
I added the in_check function, now i get:
Depth:5, Nodes:5072212, Time:16 sec, Nps:317013, Value:0 quit
Thanks for the help Uri!! Now i just have to optimize my not_in_check
function and i should be at least as fast as faile and mscp!

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls   s/call   s/call  name
 36.62      6.88     6.88  5087587     0.00     0.00  not_in_check
 13.52      9.42     2.54  5087587     0.00     0.00  undo_move
 12.40     11.75     2.33  5087587     0.00     0.00  do_move
  9.47     13.53     1.78  5087587     0.00     0.00  in_check_illegal
  8.73     15.17     1.64   206604     0.00     0.00  move_generator
  6.01     16.30     1.13 10175154     0.00     0.00  do_passant
  4.31     17.11     0.81        1     0.81    18.79  perft_doit
  3.78     17.82     0.71 20519350     0.00     0.00  get_zobrist_piece
  1.01     18.01     0.19  5294191     0.00     0.00  pop
  0.96     18.19     0.18  5087587     0.00     0.00  push
  0.69     18.32     0.13  5087587     0.00     0.00  pop_hist
  0.69     18.45     0.13  5087587     0.00     0.00  push_hist
  0.59     18.56     0.11  5294453     0.00     0.00  getToMove
  0.59     18.67     0.11  5087587     0.00     0.00  look_hist
  0.59     18.78     0.11  2154017     0.00     0.00  hist_score2
  0.05     18.79     0.01   206604     0.00     0.00  new_moves
  0.00     18.79     0.00   206604     0.00     0.00  free_move_list
  0.00     18.79     0.00   169002     0.00     0.00  do_material_getval
  0.00     18.79     0.00    84501     0.00     0.00  score_cap
  0.00     18.79     0.00      258     0.00     0.00  new_move_with_passant
  0.00     18.79     0.00        2     0.00     0.00  chess_board
  0.00     18.79     0.00        2     0.00     0.00  clearHistory



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.