Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Programming question.

Author: Bruce Moreland

Date: 16:13:58 03/19/99

Go up one level in this thread



On March 19, 1999 at 18:17:56, Inmann Werner wrote:

>On March 19, 1999 at 18:10:21, Bruce Moreland wrote:
>
>>
>>On March 19, 1999 at 18:08:02, Dann Corbit wrote:
>>
>>>Actually, something very strange is at work here.  Now that I look closely, the
>>>data objects are the same size.  Are you sure that you have the optimization
>>>settings unchanged?  Maybe you used a debug build for timing on the P90?  Did
>>>you change the instruction mix?
>>>
>>>My previous remarks assumed that you expanded the tables.  Since they are the
>>>same size, it is not the memory I/O that is a problem.
>>>
>>>Both lookups should be of identical speed.
>>
>>The way it was before should involve fewer instructions, which should mean that
>>it is faster, although who can ever tell on a Pentium.
>>
>Why fewer instructions. I did not change the instructions in the code in any
>way!

char * sz = "chicken";
char asz[] = "chicken";

These are not the same thing, by any stretch.

The first one is a 4-byte hunk of memory with a number in it.  The number is the
address of some static data, in this case 8 bytes worth.

The second one is just the 8 bytes of static data.

When the compiler wants to get at the first byte in the word "chicken", in the
first example it has to go grab the pointer out of memory, then indirect it.

In the second case the address of the data is compiled in.  It simply has it
already, it is a constant, it just indirects through this constant address,
there is no extra load.

Your example was something very similar, but no, this should not cost you 30%.
The performance decrease is still an open issue.

bruce



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.