Computer Chess Club Archives


Search

Terms

Messages

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

Author: Danniel Corbit

Date: 12:41:42 09/27/98

Go up one level in this thread


On September 27, 1998 at 14:36:22, Robert Hyatt wrote:
[snip]
>that's only true if you use the C++ syntactical tricks without using the
>major C++ functionality, namely object constructors/destructor stuff, which
>is where the overhead grows quickly.
Actually, constructors/destructors are no more or less efficient than
malloc/free+initialization calls, and you don't have to remember stuff.  There
are real penalties in C++ though.  RTTI, exception handling and a few things of
that nature can add overhead.  It's less than one percent though.  The algorithm
chosen is so much more important than the language used that the language choice
truly pales in comparison.  There are some tiny gains for assembly also.  For
instance, you cannot do a rotate right with carry or rotate left with carry in a
single cpu cycle in C or C++ like you can in assembly.  On the other hand,
optimizing compilers can do some pretty clever stuff that assembly language
programmers would be hard-put to find.

Typically, 90% of the time spent in a program happens in 5 or 10% of the code.
So if you optimize the hot spots, that is where the benefits are to be reaped.

But I agree with Amir that little will be gained by rehashing the choice of
programming language.  There are very successful assembly, C and C++ programs
that I am aware of.  If one had a large advantage, they would all be written in
that language.



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.