Re: is C necessarily faster than C++

tmb@netcom.com (Thomas Breuel)
Thu, 20 Apr 1995 04:16:33 GMT

          From comp.compilers

Related articles
[3 earlier articles]
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)
Re: is C necessarily faster than C++ tmb@netcom.com (1995-04-20)
Re: is C necessarily faster than C++ ruiter@ruls41.fsw.leidenuniv.nl (1995-04-20)
Re: is C necessarily faster than C++ cliffc@crocus.hpl.hp.com (1995-04-17)
Re: is C necessarily faster than C++ gardner@pink-panther.cs.uiuc.edu (1995-04-28)
Re: is C necessarily faster than C++ urs@engineering.ucsb.edu (1995-04-28)
Re: is C necessarily faster than C++ quanstro@hp-demo1.minerva.bah.com (1995-04-28)
Re: is C necessarily faster than C++ beard@cs.ucdavis.edu (Patrick C. Beard) (1995-04-28)
[12 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: tmb@netcom.com (Thomas Breuel)
Keywords: C, C++, performance
Organization: NETCOM On-line services
References: 95-04-044 95-04-073
Date: Thu, 20 Apr 1995 04:16:33 GMT

tbrannon <tbrannon@mars.mars.eecs.lehigh.edu> 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.
>
>Any pointers to more empirical studies?


If you know exactly what you are doing, C++ needs to be no slower than
C. However, it is very easy in C++ to write programs that have hidden
overhead (redundant copies of larger arrays, unexpected use of virtual
functions rather than direct calls, unexpected inhibition of inlining
and other optimizations, etc.). Identifying that you are wasting
time on something like that and tracking the source can be a bit of
effort, and less experienced programmers in your group may not even
know what's happening.


Thomas.
--


Post a followup to this message

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