3 ms·
Odd, CPU-wise it does pretty well here: http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=gpp&lang2=gcc&box=1 http://shootout.alioth.debian.org
by lallysingh 17y ago
Odd, CPU-wise it does pretty well here:
http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=gpp&lang2=gcc&box=1 http://shootout.alioth.debian.org/u64q/benchmark.php?test=al...
(g++ vs gcc in the language shootout).
I'm gonna guess gcc's been optimized for compilation by gcc (or at least the bootstrap version), and that no such optimization's been done for g++.
- malkia 17y agoDon't believe one benchmark. In reality any C++ code can (and it's internally) translated to C one (that's called the front-end compiler). The back-end is the same. The only difference is when there are things required by the C++ runtime (mainly exceptions and RTTI, and in some sense virtual functions). I'm sure that if you take a "C" code, and compile it under "C++" compiler (given that it can compile) - you won't see difference. Please disassemble it, and see for yourself. That's the other problem with C++ - no one actually for real writes in full C++ - you always end up sacrificing features (exceptions most notably) to have running on embedded systems, or game consoles. And no RTTI there too.