Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: speed question

Author: Dann Corbit

Date: 10:57:41 02/19/03

Go up one level in this thread


When you want to make your code faster, the most important thing is to find out
where it is slow.  I don't know how familiar you are with profiling, but a good
profiler will show you a lot about your algorithms.  On most programs, and
certaintly for chess programs, most of the time will be dominated by a few hot
spots.  If you spend the effort on the hot spots, it will be enormously more
beneficial than in other places.

Nuts and bolts tweaky sorts of things are fun to learn.  But an adjustment to
the fundamental algorithm (if it is possible) is often dominatingly better than
that.

So, my steps to make something faster are like this:
1.  Profile to find the slow spots.
2.  Examine and understand the algorithms in the slow places
3.  Look for a better algorithm
4.  If a better algorithm exists, try it
5.  If a better algorithm does not exist, try to improve the existing algorithm
6.  If still a slow spot, resort to tweaky sorts of things and inline assembly.

One idea that is often helpful is to precompute as much as possible, and store
the results in a compact lookup table.  Then the complex calculation becomes a
simple lookup.




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