Re: is C necessarily faster than C++

maccer@MT.net (Johnathon McAlister)
Thu, 6 Apr 1995 15:13:49 GMT

          From comp.compilers

Related articles
is C necessarily faster than C++ tbrannon@mars.mars.eecs.lehigh.edu (1995-04-03)
Re: is C necessarily faster than C++ rfg@rahul.net (Ronald F. Guilmette) (1995-04-06)
Re: is C necessarily faster than C++ maccer@MT.net (1995-04-06)
Re: is C necessarily faster than C++ dave@edo.ho.att.com (1995-04-16)
Re: is C necessarily faster than C++ t.hulek@imperial.ac.uk (1995-04-18)
Re: is C necessarily faster than C++ A.McEwan@lpac.ac.uk (Alistair McEwan) (1995-04-18)
Re: is C necessarily faster than C++ Marianne.Mueller@Eng.Sun.COM (1995-04-07)
Re: is C necessarily faster than C++ kohtala@laurel.trs.ntc.nokia.com (1995-04-09)
Re: is C necessarily faster than C++ rdo@elt.com (1995-04-10)
[19 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: maccer@MT.net (Johnathon McAlister)
Keywords: C, C++, performance
Organization: Compilers Central
References: 95-04-044
Date: Thu, 6 Apr 1995 15:13:49 GMT

tbrannon@mars.mars.eecs.lehigh.edu (tbrannon) wrote:


> This guy in my lab keeps refusing to use C++ in our program intended
> to simulate somatosensory neural circuits because he says it is slower
> than C. My (uninformed) response was that most of what you see as
> overhead (ie, message routing, value accessing, type checking) is
> optimized away at compile-time.


True. Message passing is either early-bound or late bound. In early
binding, we know that the message will not be overridden, and thus know
what code will be run at compile time. We can thus generate a direct
sub-routine call to said code. In late-binding, we don't know what code
will be used until run time. However, it appears that this is usually
implemented by pointers to routines - overriding a message simply entails
changing the value of the pointer. The actual call then is a jump vector,
which is also pretty fast.


Type checking is done at compile and link time - if a type error makes it
past these checks, then it won't be detected until the program blows up!
Not many languages do run time type checking.


--
Johnathon McAlister
maccer@MT.net - preferred, as it's flat rate
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.