Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why is assembly more effecient than C?

Author: Robert Hyatt

Date: 11:07:37 09/28/98

Go up one level in this thread


On September 28, 1998 at 12:40:07, Danniel Corbit wrote:

>On September 28, 1998 at 09:17:09, Robert Hyatt wrote:
>>On September 28,
>[snip]
>Dann:
>>>For thousands or millions of lines of C,
>>>an equivalent ASM is very hard to produce for Risc machines.
>>
>>I'll take that bet.  :)
>>
>>Remember:  RISC == Really Invented by Seymour Cray.  The cray has been
>>RISC from day one.  (Classic definition is one load/one store instruction,
>>everything operates on registers).  If someone writes an optimizer for a
>>processor, I *guarantee* you that I can write code better, because *every*
>>optimizer has concessions.  They are very good, no doubt, but *not* as good
>>as someone that understands the architecture in fine detail...  That's why
>>the scientific labs have folks that do nothing but take existing code and
>>hand-code assembly replacements to make them run faster.  This was Harry's
>>job at livermore lab from the time they got their first Cray-1...
>Probably depends on the chip.  Consider a sparc.  256 registers.  Do you imagine
>that a person can really track those better than a machine over millions of
>invocations and context switches?

Yes...  first, only 32 of them are visible at one instant.  You can expose
others by dinking with the register window.  But let's take a cray...  8 vector
registers, each with 128 words in them, 8 64 bit scalar registers + 64 temporary
registers than can be used to save/load scalar values in 1 cycle, plus 8 32bit
scalar registers + 64 temporary registers for those.  Can anyone use *all* of
those?  Absolutely.  I have a piece of code that does it, in fact.  Chess board
here, repetition list there, current move stack over yonder, saved hash keys
back there, etc...

So it is doable.  But as I said, it takes work.  But I'd take on any compiler
and optimizer I know of, I beat Cray's compiler, the next best one I know of is
the HP compiler, and I'd be willing to challenge it as well, if I had the time
to get up on the HP architecture for a while.  That's the plus for C, you don't
have to know if your machine has 8 registers like the X86 or thousands like the
multiple-cpu crays...



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.