Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Optimizing C code for speed

Author: Russell Reagan

Date: 18:55:10 01/01/03

Go up one level in this thread


On January 01, 2003 at 19:13:20, Uri Blass wrote:

>1)why it should not matter even with no optimization?
>
>Correct me if I am wrong but it seems that with the fastest way you need more
>memory because you need to remember also x so theoretically it is possible that
>the computer will crush because of memory problem in the first case when it does
>not crash in the second case.

It will be in a register if it's a double word sized value. If not it will be in
the cache. Memory has nothing to do with this problem.

>2)Suppose that you try optimization for minimize size and not maximal speed
>Am I correct to assume that the compiler will not define the varaible x?

If the data is used often, then it will be in the cache and there will be no
memory accessed at all. If it is not used often, then it is not a critical part
of the program most likely (in terms of speed). Besides, the cpu doesn't think
in terms of "variables". The compiler won't have anything to do with whether or
not this value is in the cache. That's a hardware thing, not a software thing.



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.