Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C (compiler) question

Author: Andrew Platt

Date: 04:55:53 09/15/04

Go up one level in this thread


On September 15, 2004 at 06:59:30, Tony Werten wrote:

>Hi all,
>
>I was just wondering. Should I declare all my variables (psqtables, hashnumbers
>etc ) in the main file so they are all nicely together in memory, or rather in
>the file that uses them most, so they are closer to the calling code ?
>
>Tony

It's irrelevant: compilers and linkers place all of the data items into data
sections away from the code. O/Ses, along with the hardware, load these into
separate memory pages for isolation and CPUs have separate instruction and data
caches so close proximity isn't a concern there.

On some O/Ses you can get a small benefit by using static variables instead of
extern where this works out because global variables are accessed via a lookup
table. This is usually only when they would be exported out of the load module
but can sometimes happen to executables given certain flags.

Andy.




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.