Computer Chess Club Archives


Search

Terms

Messages

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

Author: Robert Hyatt

Date: 11:02:10 09/29/98

Go up one level in this thread


On September 29, 1998 at 12:00:20, Danniel Corbit wrote:

>On September 29, 1998 at 08:04:28, Robert Hyatt wrote:
>[snip]
>>It depends on how you define "better"...  Note that Crafty is pure C now
>>because of the portability issue and the time issue.  I'd love to write the
>>fastest code I could in asm, but the target platform changes about once every
>>2-3 years, while we had many man-years (Harry and I) in the assembly code for
>>Cray Blitz.
>That's one of the focal points of the problem.  CPU's change over time, even
>within the same family.  What is fast for a CPU may not be fast for its next
>generation.  Also, the volume of code is a problem.  An age old adage is still
>true:
>
>A good programmer produces tens of lines of debugged code per hour.
>
>[This takes into account design, meetings, debugging, beta test and all of
>that].  The *volume* of assembly language is much higher than that of C or other
>higher level languages.  That makes it slower to write.
>
>On the other hand, if you can identify a hot spot, it is fairly simple to recode
>that small portion in Assembly language.  One approach that I often use is to
>use the compiler to generate assembly language for a C function.  Then I look
>over what the compiler did carefully and make changes where they are warranted.
>This method also creates all the interface setup for you and saves a bit of time
>that way.
>
>I'm actually pretty surprised how even-handed crafty is.  I have run it through
>a profiler several times, and I can't really see any places that are enormous
>bottle-necks.
>[snip]



The big cpu user in crafty is Evaluate() and it's component procedures,
which add up to some 50% total, generally.  There's some work to be done
there, but I've hesitated to start optimizing in there because I'm still
not "done" adding things... and until it reaches some reasonably close
approximation to where it will end up, there's little point to spend a lot
of time optimizing something that has changed frequently and sometimes
significantly...



This page took 0.01 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.