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) |
Re: is C necessarily faster than C++ tmb@netcom.com (1995-04-20) |
[18 later articles] |
Newsgroups: | comp.compilers |
From: | dave@edo.ho.att.com (Dave Hayden) |
Keywords: | C, C++, performance |
Organization: | AT&T |
References: | 95-04-044 |
Date: | Sun, 16 Apr 1995 19:51:16 GMT |
tbrannon@mars.mars.eecs.lehigh.edu (tbrannon) writes:
>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?
Although C++ can be just as fast as C, it can also be horribly slow.
For example, the Mac compilers that I've seen must search through tables
to find a virtual function. The result is 20 - 100 instructions of overhead
just to call a virtual function. Also, constructors and destructors
can add lots of wasted time.
Of course, the best way to improve performance is to write the
program (keeping performance in mind when designing algorithms), run
it with a profiler, and see what's taking all the time. This will
give lots of benefit no matter what the language is.
--
David Hayden dave@babel.ho.att.com
AT&T Bell Laboratories (908)946-1107
943 Holmdel Road
Holmdel, NJ 07733
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.