The Computer Language
Benchmarks Game

C gcc versus C++ g++ 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.

regex-redux
source secs mem gz busy cpu load
C gcc 0.80 152,196 1397 2.03 48% 100% 54% 53%
C++ g++ 1.08 203,816 1315 3.38 78% 99% 65% 73%
fasta
source secs mem gz busy cpu load
C gcc 0.78 1,220 1463 0.79 1% 0% 0% 100%
C++ g++ 0.78 2,468 2751 1.62 8% 99% 99% 3%
spectral-norm
source secs mem gz busy cpu load
C gcc 0.72 1,100 569 2.86 100% 99% 100% 100%
C++ g++ 0.72 1,216 1044 2.86 100% 100% 99% 100%
n-body
source secs mem gz busy cpu load
C gcc 4.30 8 1391 4.32 0% 0% 0% 100%
C++ g++ 4.09 1,800 1808 4.13 100% 0% 0% 0%
pidigits
source secs mem gz busy cpu load
C gcc 0.73 2,848 416 0.75 1% 100% 1% 0%
C++ g++ 0.60 4,944 986 2.38 100% 100% 98% 100%
reverse-complement
source secs mem gz busy cpu load
C gcc 0.86 698,264 820 1.27 1% 18% 100% 28%
C++ g++ 0.63 499,704 2093 0.64 0% 100% 2% 0%
mandelbrot
source secs mem gz busy cpu load
C gcc 1.27 31,692 1135 5.08 100% 100% 100% 99%
C++ g++ 0.84 34,604 3542 3.28 98% 99% 98% 95%
fannkuch-redux
source secs mem gz busy cpu load
C gcc 7.52 836 910 29.37 99% 100% 93% 99%
C++ g++ 4.91 1,912 1482 19.45 100% 99% 97% 100%
binary-trees
source secs mem gz busy cpu load
C gcc 1.79 168,760 809 5.35 64% 64% 71% 100%
C++ g++ 1.04 154,824 1122 3.74 88% 100% 88% 86%
k-nucleotide
source secs mem gz busy cpu load
C gcc 3.81 130,112 1506 12.18 54% 87% 79% 100%
C++ g++ 1.95 156,372 1631 5.95 73% 70% 92% 70%
C gcc

gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0

C++ g++

g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0