Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C (compiler) question

Author: Tony Werten

Date: 12:31:36 09/15/04

Go up one level in this thread


On September 15, 2004 at 14:00:59, Gerd Isenberg wrote:

>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
>
>Hi Tony,
>
>It is probably compliler/linker implementation dependent in which order and in
>how many "segments" (.bss, .data for msc) your global data is placed.
>Most likely the address order correspondents with the definition order in the
>source files and the order the source/obj/lib files are linked.
>At least two variable pools, one for variables one for explicite const
>variables, probably more - not sure with statics.
>
>Do you have compile time initialized const data or data initialized once at
>runtime?

Both, but most runtime.

>
>There are const/variable global variables with or without namespaces, shared by
>several "modules". They are usually declared as extern in an common header file,
>and implemented in any c-file using the same namespace, e.g. the global one.
>You may use a separate c-file only for variable definitions.
>
>You may generate a map-file to inspect the addresses (offsets) of global
>variables.
>
>There are three static globals in c/c++.
>In c-file or module rank, inside a function, inside a struct/class.
>For the first two, i am not sure in which order they occur in the executable
>- guessing:
>
>.data:
>... constMStatic1, constMStatic2,..., constFStatic1, constFStatic2,...
>.bss:
>... moduleStatic1, moduleStatic2,..., functionStatic1, functionMStatic2,...
>
>For msc .data and .bss are concatinated with x86-32 flat segment model.
>
>As for locals too, it may be faster to keep often used variables close together,
>because you need less cachelines and 4K pages.
>
>E.g. to avoid:
><1K often used> <4K seldom used> <3K often used>
>faster:
><1K often used> <3K often used> <4K seldom used>
>
>probably with the drawback to don't use the const keyword for compile time
>initialized data.

OK Thanks.

>
>Btw. what compiler do you use for your new XiniX with Kogge Stone bitboards?

I'm using Visual C++ 2005 Not very good for optimizing though.

Tony

>
>Cheers,
>Gerd



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.