The Computer Language
Benchmarks Game

C gcc versus C++ g++ fastest programs

Always look at the source code.

These are only the fastest programs. 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 148,844 1397 2.03 53% 100% 54% 48%
C++ g++ 1.03 275,752 2850 2.19 36% 37% 100% 40%
pidigits
source secs mem gz busy cpu load
C gcc 0.81 2,664 416 0.84 1% 0% 100% 2%
C++ g++ 0.89 4,236 513 0.89 0% 0% 100% 0%
fannkuch-redux
source secs mem gz busy cpu load
C gcc 7.45 692 910 29.11 93% 100% 100% 98%
C++ g++ 7.92 1,700 980 30.88 100% 99% 98% 93%
fasta
source secs mem gz busy cpu load
C gcc 0.82 2,888 2268 3.27 100% 99% 100% 100%
C++ g++ 0.85 2,020 2711 3.13 92% 92% 92% 93%
spectral-norm
source secs mem gz busy cpu load
C gcc 0.72 1,020 569 2.87 100% 100% 100% 99%
C++ g++ 0.72 2,348 1044 2.84 100% 99% 99% 99%
n-body
source secs mem gz busy cpu load
C gcc 4.25 8 1391 4.37 100% 0% 2% 0%
C++ g++ 3.94 1,604 1808 4.02 0% 1% 100% 1%
binary-trees
source secs mem gz busy cpu load
C gcc 1.96 103,240 836 5.52 100% 65% 59% 58%
C++ g++ 1.53 112,820 1270 4.03 99% 59% 52% 53%
reverse-complement
source secs mem gz busy cpu load
C gcc 0.86 624,308 820 1.23 27% 18% 99% 0%
C++ g++ 0.63 499,668 2093 0.64 2% 0% 0% 100%
mandelbrot
source secs mem gz busy cpu load
C gcc 1.26 24,836 1135 5.00 99% 100% 100% 99%
C++ g++ 0.88 34,608 3542 3.47 98% 100% 98% 97%
k-nucleotide
source secs mem gz busy cpu load
C gcc 3.43 130,252 1506 11.17 90% 92% 88% 56%
C++ g++ 1.98 156,108 1631 5.92 96% 67% 68% 68%
C gcc

gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0

C++ g++

g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0