The Computer Language
Benchmarks Game

C++ g++ programs versus C gcc

by benchmark task performance

k-nucleotide
source secs mem gz cpu cpu load
C++ g++ 3.66 155,956 1624 11.16 70% 98% 70% 68%
C gcc 5.07 130,008 1506 15.25 88% 84% 58% 73%
n-body
source secs mem gz cpu cpu load
C++ g++ 8.24 1,924 1763 8.23 1% 0% 100% 1%
C gcc 9.22 1,228 1490 9.22 100% 1% 1% 0%
mandelbrot
source secs mem gz cpu cpu load
C++ g++ 1.51 25,588 1791 5.99 99% 99% 99% 99%
C gcc 1.64 26,416 1135 6.55 100% 100% 99% 100%
spectral-norm
source secs mem gz cpu cpu load
C++ g++ 1.98 1,340 1044 7.87 99% 100% 99% 99%
C gcc 1.99 1,292 569 7.89 99% 99% 99% 99%
fasta
source secs mem gz cpu cpu load
C++ g++ 1.33 1,956 2711 4.16 79% 79% 79% 79%
C gcc 1.32 2,892 2268 5.22 100% 100% 99% 99%
binary-trees
source secs mem gz cpu cpu load
C++ g++ 2.62 130,212 809 7.92 76% 67% 63% 99%
C gcc 2.54 130,292 836 7.76 78% 67% 64% 98%
pidigits
source secs mem gz cpu cpu load
C++ g++ 1.89 4,284 513 1.88 5% 0% 1% 100%
C gcc 1.75 2,728 452 1.74 1% 2% 0% 100%
regex-redux
source secs mem gz cpu cpu load
C++ g++ 1.66 203,568 1315 4.23 48% 53% 57% 99%
C gcc 1.50 152,088 1230 4.06 54% 59% 60% 100%
fannkuch-redux
source secs mem gz cpu cpu load
C++ g++ 10.62 2,040 980 41.91 100% 95% 100% 100%
C gcc 8.72 980 910 34.43 98% 97% 100% 100%
reverse-complement
source secs mem gz cpu cpu load
C++ g++ 2.95 980,472 2280 4.56 50% 41% 16% 50%
C gcc 1.75 994,468 1438 3.96 48% 44% 95% 44%
C++ g++

g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0

C gcc

gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0