The Computer Language
Benchmarks Game

C gcc programs versus C++ g++

by benchmark task performance

binary-trees
source secs KB gz cpu cpu load
C gcc 3.28 156,780 906 10.12 91% 77% 59% 83%
C++ g++ 6.98 150,512 846 6.97 100% 0% 0% 1%
regex-dna
source secs KB gz cpu cpu load
C gcc 2.43 339,000 2579 5.68 46% 70% 51% 72%
C++ g++ 3.89 242,200 695 6.50 0% 77% 1% 91%
fannkuch-redux
source secs KB gz cpu cpu load
C gcc 9.07 1,576 910 35.43 100% 99% 98% 94%
C++ g++ 13.17 1,944 1439 51.41 93% 100% 98% 100%
reverse-complement
source secs KB gz cpu cpu load
C gcc 0.42 145,900 812 0.57 0% 26% 20% 100%
C++ g++ 0.59 217,564 2275 0.84 26% 78% 12% 34%
pidigits
source secs KB gz cpu cpu load
C gcc 1.73 1,992 448 1.73 1% 100% 1% 0%
C++ g++ 2.29 4,028 682 2.29 2% 5% 1% 100%
fasta
source secs KB gz cpu cpu load
C gcc 1.36 2,800 1993 5.26 96% 97% 100% 97%
C++ g++ 1.50 4,092 2313 5.17 87% 87% 87% 87%
k-nucleotide
source secs KB gz cpu cpu load
C gcc 6.46 130,076 1500 17.06 51% 37% 89% 88%
C++ g++ 7.15 164,080 1252 24.21 82% 83% 80% 96%
spectral-norm
source secs KB gz cpu cpu load
C gcc 1.98 1,776 1139 7.87 99% 99% 100% 99%
C++ g++ 2.01 1,792 1044 8.00 100% 100% 100% 100%
mandelbrot
source secs KB gz cpu cpu load
C gcc 5.92 32,572 694 22.78 95% 95% 95% 100%
C++ g++ 5.82 33,952 726 22.40 96% 95% 95% 100%
n-body
source secs KB gz cpu cpu load
C gcc 9.56 1,000 1490 9.56 1% 100% 1% 1%
C++ g++ 9.30 1,712 1763 9.29 100% 1% 1% 0%
C gcc

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609

C++ g++

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609