Re: C++ vs C compiler on size

"Stanley Chow" <schow@nortel.ca>
14 Jan 1997 20:07:27 -0500

          From comp.compilers

Related articles
C++ vs C compiler on size yeh@netcom.com (1997-01-07)
Re: C++ vs C compiler on size robison@kai.com (Arch Robison) (1997-01-09)
Re: C++ vs C compiler on size fjh@mundook.cs.mu.OZ.AU (1997-01-12)
Re: C++ vs C compiler on size bill@amber.ssd.csd.harris.com (1997-01-12)
Re: C++ vs C compiler on size jlilley@empathy.com (1997-01-12)
Re: C++ vs C compiler on size schow@nortel.ca (Stanley Chow) (1997-01-14)
Re: C++ vs C compiler on size jwdonah@ibm.net (Joseph Donahue) (1997-01-14)
Re: C++ vs C compiler on size aeb@saltfarm.bt.co.uk (1997-01-16)
Re: C++ vs C compiler on size edi-c@algonet.se (Kurt Svensson) (1997-01-16)
| List of all articles for this month |

From: "Stanley Chow" <schow@nortel.ca>
Newsgroups: comp.compilers
Date: 14 Jan 1997 20:07:27 -0500
Organization: Bell-Northern Research Ltd.
References: 97-01-048 97-01-086
Keywords: C, C++, code

yeh@netcom.com (Zhenghao Yeh) writes:
>> How much overhead we have to pay if we need:
>> 1. inheritance?
>> 2. virtual functions?
>> 3. template?


Bill Leonard <Bill.Leonard@hawk.hcsc.com> wrote:
>I don't think anyone can answer that definitively -- it depends too
>much on the compiler, the machine architecture, and exactly how those
>features are being used.


True. It happens that I hacked together a test to compare the
speed of virtual functions vs C equivalent. On the platform/compiler
combinations that I tried, virtual functions came in average 10%
slower.


>If you are comparing C++ to C, then you should compare two equivalent
>things. For instance, compare a virtual function call to the
>*equivalent* C code that would implement the same functionality.


In my case, I tried to compare apples to apples and the simplest
virtual function usage is slower than the most general ptr-to-function
usage.


--
Stanley Chow; schow@bnr.ca, stanley.chow-ott@nt.com; (613) 763-2831
Bell Northern Research Ltd., PO Box 3511 Station C, Ottawa, Ontario
--


Post a followup to this message

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