The Computer Language
Benchmarks Game

C++ g++ programs versus C gcc

by benchmark task performance

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

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

C gcc

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