The Computer Language
Benchmarks Game

C++ g++ versus C gcc fastest programs

Always look at the source code.

These are only the fastest programs. Do some of them use manually vectorized SIMD? Look at the other programs. They may seem more-like a fair comparison to you.

fannkuch-redux
source secs mem gz busy cpu load
C++ g++ 3.29 1,892 1528 13.06 100% 100% 100% 97%
C gcc 7.58 872 910 29.61 100% 98% 99% 93%
k-nucleotide
source secs mem gz busy cpu load
C++ g++ 1.93 156,548 1631 5.88 69% 93% 69% 75%
C gcc 3.72 130,260 1506 12.07 100% 89% 78% 57%
reverse-complement
source secs mem gz busy cpu load
C++ g++ 0.52 1,788 1853 0.52 0% 98% 0% 2%
C gcc 0.86 712,208 820 1.27 99% 28% 1% 19%
binary-trees
source secs mem gz busy cpu load
C++ g++ 0.94 176,428 1122 3.39 86% 88% 100% 85%
C gcc 1.54 168,832 809 4.35 60% 67% 57% 100%
mandelbrot
source secs mem gz busy cpu load
C++ g++ 0.84 34,780 3542 3.27 99% 98% 98% 96%
C gcc 1.27 31,792 1135 5.08 100% 100% 99% 100%
n-body
source secs mem gz busy cpu load
C++ g++ 2.12 764 1927 2.17 0% 2% 100% 0%
C gcc 2.18 768 1633 2.19 0% 100% 0% 0%
fasta
source secs mem gz busy cpu load
C++ g++ 0.77 2,504 2751 1.52 64% 0% 99% 37%
C gcc 0.78 1,156 1463 0.78 0% 0% 0% 100%
pidigits
source secs mem gz busy cpu load
C++ g++ 0.66 5,152 986 2.63 100% 100% 100% 100%
C gcc 0.59 2,444 1090 2.37 100% 100% 100% 98%
regex-redux
source secs mem gz busy cpu load
C++ g++ 1.10 203,924 1315 3.43 63% 77% 71% 100%
C gcc 0.80 152,172 1397 2.01 52% 99% 48% 53%
spectral-norm
source secs mem gz busy cpu load
C++ g++ 0.72 1,192 1044 2.85 99% 99% 100% 100%
C gcc 0.40 872 1197 1.58 100% 100% 100% 98%
C++ g++

g++ (Ubuntu 10.3.0-1ubuntu1) 10.3.0

C gcc

gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0