Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Object files and code speed

Author: Robert Hyatt

Date: 10:06:04 10/24/03

Go up one level in this thread


On October 23, 2003 at 14:25:07, Matthew McKnight wrote:

>I was aiming to speed up my over-all nodes per second.  Previously I had one
>object that did make/unmake move, evaluation, and some general board
>maintenance.  I broke the object into three, one for each respective portion.
>The new version seems to be about 3% slower.  The original object was huge, so I
>assumed that breaking it down would make it quicker, not slower, especially with
>relevant functions grouped together.  Am I incorrect to assume that smaller
>objects, when logically organized, are faster?  Or should everything be together
>like before?
>
>Matt


The question is complex.

1.  If you broke the source into multiple files to produce multiple object
files, you might have hurt optimization, if the compiler found any good
opportunities to "inline" some of the functions you have that are very
small.  If a source is in a separate file, it can't be inlined.

2.  Sometimes just moving objects around can change things.  But, in general,
you want the often-called stuff close together in memory, for multiple
reasons.  First, it is more cache-efficient to fetch a line and have that
line contain useful stuff rather than stuff that won't be executed.  Second,
spreading things out in memory can lead to cache line aliasing problems that
effectively reduce the size of cache.



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.