This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Comparative performance of C(gcc) and C++(g++)


Hi Ivan,

>Can i really gain in run time speed and memory using C instead C++ ?

No, you cannot gain in run time speed and memory using C instead of C++.

Well written C and well written C++ are comparable in run time speed and
memory.

Poorly written C or C++... then all bets are off.

However (BIG HOWEVER) C++ provides many Big Hammers that have known
overhead.  It is possible for someone unaware of the costs (performance
and/or code bloat) of those powerful tools, and my use them inappropriately.
For example, using a list<int> instead of a vector<int>, and wondering why
the performance is poor FOR A GIVEN PROBLEM DOMAIN.

C does not provide those kind of Big Hammers, so inexperienced or naïve
programmers cannot "accidently" use them.  Note:  many third party libraries
exist that DO provide those same kind of Big Hammers for C.  I was just
referring to the Standard C Library, and the Standard C++ Library.

>Where i can find resources in comparative benchmarking over these languages ?

I don't know.  I wrote my own, just to satisfy my own curiosity.
  
>How is the gain ( if there is ) of C over C++?

There's not.

Sincerely,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]