Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Design choices in Crafty

Author: Russell Reagan

Date: 17:54:24 06/23/04

Go up one level in this thread


On June 23, 2004 at 19:52:45, Ed Trice wrote:

>If you profile Crafty, you will find something like only 11% of the computation
>is spent on the evaluation routine. Say you were to make this code execute twice
>as fast. Then, overall, the entire program would be only 5.5% faster.
>
>To make a big performance gain, you have to attack the bottlenecks.


I agree with that logic. At the same time, I think it should come with a
warning. A lot of times people mistakenly interpret this advice as, "ignore
optimization until the program is operational." I think that by doing that, you
are placing the upper limit on how fast the program can potentially be much
lower than it should be.

Let's say I write my program, and I ignore optimization issues early on. The
program is now operational, and now I start to work on optimizations. I profile
it, hunt down hot spots, and get to the point where there are no obvious
bottlenecks. The program is still ten times slower than Crafty. Now what? I am
saddled with a poor overall design, and nothing short of a complete rewrite is
going to improve the situation.


I also have to disagree with that number, 11%. I just compiled it and ran it
through a profiler. Here are the top 20 consumers. Evaluation totals almost 50%
of the execution time. However, your point is well taken. Spending a significant
amount of time improving MakeMove() and UnmakeMove() wouldn't gain much.


Method Name        % in Method   % with Children   Called      Average
Evaluate               22.2            45.9        84,623         6.6
EvaluatePawns          17.1            17.1        53,913           8
Search                  7.4            90.9        34,386         5.4
GenerateCaptures        7.3             7.3        51,903         3.5
MakeMove                6.6             6.6        92,827         1.8
UnmakeMove              4.4             4.4        92,823         1.2
Attacked                4.1             4.1       144,934         0.7
Quiesce                 3.7            61.2        84,623         1.1
NextMove                3.5             6.4        72,219         1.2
InitializeHashTables    3.1             3.1             5   15,640.10
EvaluateKingSafety      2.7             2.7        84,621         0.8
EvaluateDevelopmentW    1.7             1.7        84,623         0.5
Swap                    1.7             3.4        34,061         1.2
HashProbe               1.6             1.6        34,390         1.2
EvaluateDevelopmentB    1.4             1.4        84,623         0.4
HashStore               1.3             1.3        28,957         1.1
Iterate                 1.1            93.8             4    7,106.40
AttacksTo               1.1             1.1        36,998         0.7
InitializeZeroMasks     0.9             0.9             1   22,945.10
GenerateNonCaptures     0.9             0.9         2,786         7.7



This page took 0.02 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.