Computer Chess Club Archives


Search

Terms

Messages

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

Author: Danniel Corbit

Date: 09:00:20 09/29/98

Go up one level in this thread


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]



This page took 0.06 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.