Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: about SEE of Crafty

Author: Robert Hyatt

Date: 06:42:56 01/06/04

Go up one level in this thread


On January 05, 2004 at 18:51:11, Sune Fischer wrote:

>On January 05, 2004 at 18:30:59, Uri Blass wrote:
>
>
>>Remmeber that the check is only going to be done at most 4 times in common
>>cases(I think that in most cases you have even not more than 2 captures in the
>>same square for example 1.e4 e5 2.Nf3 Nc6 3.Nxe5 Nxe5 no more captures).
>
>Ok, but even 2 checks is 2 more than you need. :)
>
>>I remember from experience with my program that allocating memory for varaibles
>>in functions is expensive and in the early days of movei I got a significant
>>speed improvement by having global arrays instead of having local arrays even in
>>cases that I did not need to use the global array out of the function.
>
>I don't blieve there should be any overhead unless you initialize them.
>
>From what I understand the processor just allocates a certain stack space, the
>size of the stack should not matter.
>Though now that you mention it things often seem to be initialized to zero
>regardless, so maybe there's something I don't understand here.

The normal "rule" is this:  Each memory address is _initially_ set to zero.
In linux, this is done by setting all such memory pages to "fill with zero"
so that the first reference will result in the page being added to the
resident set and zeroed out completely.  This means all static variables will
initially be set to zero.  Local function variables don't get that same
treatment, because they are allocated on the stack, and once the stack is
used, the zero values get overwritten and they _never_ get zeroed again unless
you explicitly zero them yourself.

>
>But in any case you can make it static, right?
>That would keep it alive until you need it again, sort of like global only
>within the function's scope.

yes, but _BAD_ for multi-threading.

>
>-S.
>>Uri



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.