Re: is C necessarily faster than C++

gardner@pink-panther.cs.uiuc.edu (Mark K. Gardner)
Fri, 28 Apr 1995 19:00:52 GMT

          From comp.compilers

Related articles
[6 earlier articles]
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)
is C necessarily faster than C++ ka@socrates.hr.att.com (1995-04-28)
Re: is C necessarily faster than C++ jplevyak@pink-panther.cs.uiuc.edu (1995-04-29)
Re: is C necessarily faster than C++ tmb@netcom.com (1995-04-29)
[9 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: gardner@pink-panther.cs.uiuc.edu (Mark K. Gardner)
Keywords: C, C++, performance
Organization: University of Illinois at Urbana
References: 95-04-044
Date: Fri, 28 Apr 1995 19:00:52 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?


Yes. My Masters thesis, entitled "A Comparative Study of the Locality
Charateristics of an Object-Oriented Language", compares the cache
locality of two programs that perform the same function. One is
written in C; the other in C++. Both were compiled with the same
compiler. Hardware aquired memory reference traces of the two programs
were compare on the basis of cache misses. The results indicates that
C++ programs can have 2-3 times more cache misses. On today's machines
that translates into a significant performance difference. On tomarrow's
machines, the effect will be even more pronounced.


It should be noted that I was not trying to compare C and C++. The
objective was to compare object-oriented'ness with a traditional style.
The C++ program was excessively object-oriented, while the C program was
well structured. Thus the results are probably (and were intended to be)
a rough bound on the penalty of adopting an object-oriented style.
Naturally, YMMV.


Finally, the thesis is not on-line (yet). I am having troubles getting
the postscript file to print properly (it was generated on a Macintosh
and doesn't seem to print properly from UNIX). I would imagine you can
obtain a hard copy by contacting the Computer Science Department,
Brigham Young University, TMCB, Provo, UT 84601.


--


-Mark- mkgardne@uiuc.edu (mkgardne@cs.uiuc.edu)
--


Post a followup to this message

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