Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!watmath!watdragon!dvadura From: dvadura@watdragon.waterloo.edu (Dennis Vadura) Newsgroups: comp.lang.c++ Subject: Efficiency of C++ relative to C?? Message-ID: <16493@watdragon.waterloo.edu> Date: 19 Sep 89 01:43:33 GMT Reply-To: dvadura@watdragon.waterloo.edu (Dennis Vadura) Organization: Computer Science Dept., University of Waterloo Lines: 45 I have the following question: Has anyone performed a study comparing the execution time cost of C++ language features compared to C? In particular I am interested in the following problem. Given a particular program, code it in C and code it in C++ using the full power of C++. Time the execution speed of both programs on the same input data. Then ask how much of the cost of the C++ program is due to the use of virtual functions, and what is the call overhead for a virtual function when compared to the call overhead for a normal call in C? This may not be the best way to determine what I am after, but I want a feel for how much of a penalty (if any, although I suspect it's there and may be quite large) using C++ is going to incur if I switch from using C to using C++ for large software projects because I want to use the enhanced expressive power of C++ over C. As an example there exist companies that spend 100's of thousands a year to improve the efficiency of their code by 5%. If on average C++ language features incur high overhead then the cost in efficiency for them to switch to a language like C++ with its enhanced expressive power is too prohibitive. Such a move would represent a large step backward in their product. So I am looking for paper references to such studies, or even anecdotal experience, as I don't think many such studies exist. ie. what is the net consensus on this? If I care about the efficiency of my code and want to keep it as efficient as it is presently but switch to C++, is this a realistic expectation. If not, then why is my expectation unrelistic, and how do I address a solution? Is a clever optimizer sufficient? Send mail and I will collect the responses and summarize to the net. -thanks -dennis -- -------------------------------------------------------------------------------- The only happy people are Single MEN |Dennis UUCP,BITNET: dvadura@water and Married WOMEN. |Vadura EDU,CDN,CSNET: dvadura@waterloo ================================================================================