Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about when to do { profile; watch; think; try; } while(1);

Author: Uri Blass

Date: 03:27:22 09/08/03

Go up one level in this thread


On September 08, 2003 at 03:55:59, Johan de Koning wrote:

>On September 05, 2003 at 16:17:48, Uri Blass wrote:
>
>>I want to have some rule when it is a good idea to use local varaibles.
>
>Dear Uri,
>Do you have any [BLEEP]ing clue about where 90% of your CPU is spent?
>
>... Johan

I did profiling of the last version in the opening position after searching
7241728 nodes

I think that I can post results without too much risk of discovering secrets  of
my program.

Here are the main functions

Note that both my makemove and my undomove call pseudoadd and pseudodelete that
update a lot of arrays that also help to generate moves faster but do not update
the array of the pawn structure and updating the array of the pawn structure is
probably done as inlined function of makemove or unmake move so I do not know
exactly how much time it takes.

genwithoutpin generate moves when there are no pinned pieces when genpin
generate moves when there are pinned pieces.

sort order the moves

13601.916  10.6    13601.916  10.6 17221218 @pseudoadd@4 (boardi.obj)
13257.964  10.4    13257.964  10.4 17221186 @pseudodelete@4 (boardi.obj)
12669.525   9.9    41129.386  32.1  7241728 @makemove@4 (boardi.obj)
10678.639   8.3    22172.455  17.3  4682822 @genwithoutpin@0 (boardi.obj)
9730.827    7.6     9730.827   7.6 23217388 @sort@4 (evaluate.obj)
7013.472    5.5    25544.791  19.9  7241728 @undomove@0 (boardi.obj)

These function catched 52.3% of the time

less important function but still important

Quies is the function that does the qsearch including checks in the first plies
of the qsearch
quiesmall does qsearch without checks(deeper in the tree)

Something that I notice for evalmove
I have a very simple function as evalmove

int evalmove(move_bytes m)
{
	return evalmovewithoutpawns(m)+evalpawnchange(m);
}

evalmovewithoutpawns is only called from evalmove.

evalmove is calculated every makemove in boardi.c but it is also calculated for
some moves that are not made in evaluate.c when I may decide based on the result
if to make them.

I guess that the compiler simply inline evalmove only when it is called from the
same file that it is defined(I use inline any suitable).

It cannot inline evalmove from other files because the functions
evalmovewithoutpawns and evalpawnchange are not defined in protos.h

I will try to define them in protos.h to see if it make things faster.




5593.523   4.4    57268.009  44.7  3045178 @Quies@12 (evaluate.obj)
5144.494   4.0   124395.265  97.1  3186150 @alphabeta@16 (evaluate.obj)
3054.795   2.4     5095.522   4.0 10929886 @evalmovewithoutpawns@4
(evaluate.obj)
3036.748   2.4    19643.869  15.3  1434206 @quiesmall@12 (evaluate.obj)
3014.945   2.4     7643.262   6.0  7241728 @evalmove@4 (evaluate.obj)
2647.709   2.1     2647.709   2.1 15267724 @trouble@0 (boardi.obj)
2571.980   2.0     2572.211   2.0  7241729 @evalrest@0 (evaluate.obj)
2556.701   2.0     2556.701   2.0  9047728 @generatesimplequietbishops@4
(boardi.obj)
2368.494   1.8     2368.494   1.8 13981826 @genquietblack1and2squares@4
(boardi.obj)
2335.030   1.8     2335.030   1.8 10417738 @generatesimplequietrooks@4
(boardi.obj)
2109.567   1.6     2109.567   1.6 12407026 @genquietwhite1and2squares@4
(boardi.obj)
2052.373   1.6     2052.373   1.6  8224726 @gen_push@8 (boardi.obj)
2040.727   1.6     2040.727   1.6 10929886 @evalchange@8 (evaluate.obj)
2018.445   1.6    29093.974  22.7  5934425 @gen@0 (boardi.obj)
1998.274   1.6     1998.274   1.6 10929886 @evalpawnchange@4 (evaluate.obj)
1843.949   1.4   126599.279  98.9        1 @xboard@0 (main.obj)
1719.196   1.3     3844.937   3.0   673713 @genpin@0 (boardi.obj)
1493.236   1.2     1493.236   1.2  7979464 @updatewhitepiece@8 (boardi.obj)
1462.003   1.1   128061.282 100.0        1 _main (main.obj)

main and xboard are not important and they are practically not called in the
search so you can ignore them.

Uri



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.