The Computer Language
Benchmarks Game

C++ g++ programs versus C gcc

by benchmark task performance

n-body
source secs mem gz cpu cpu load
C++ g++ 9.31 1,052 1544 9.30 1% 1% 1% 100%
C gcc 9.96 1,016 1490 9.95 1% 1% 1% 100%
binary-trees
source secs mem gz cpu cpu load
C++ g++ 2.36 114,404 809 7.69 86% 71% 87% 85%
C gcc 2.38 131,728 836 7.70 98% 87% 73% 68%
spectral-norm
source secs mem gz cpu cpu load
C++ g++ 1.99 1,880 1044 7.89 100% 99% 99% 99%
C gcc 1.99 1,824 1139 7.88 99% 99% 99% 100%
mandelbrot
source secs mem gz cpu cpu load
C++ g++ 1.73 34,064 1002 6.80 98% 98% 98% 99%
C gcc 1.65 32,684 1135 6.53 99% 99% 100% 99%
pidigits
source secs mem gz cpu cpu load
C++ g++ 1.89 3,868 508 1.89 100% 1% 2% 1%
C gcc 1.73 2,116 448 1.73 1% 99% 1% 0%
fasta
source secs mem gz cpu cpu load
C++ g++ 1.48 4,176 2313 5.25 89% 90% 88% 89%
C gcc 1.33 2,856 2249 5.28 100% 99% 100% 99%
fannkuch-redux
source secs mem gz cpu cpu load
C++ g++ 10.35 2,624 980 40.60 99% 99% 100% 95%
C gcc 8.97 1,660 910 35.00 98% 94% 99% 100%
k-nucleotide
source secs mem gz cpu cpu load
C++ g++ 7.18 164,052 1252 24.28 83% 83% 93% 83%
C gcc 5.38 129,772 1499 16.37 61% 82% 89% 74%
reverse-complement
source secs mem gz cpu cpu load
C++ g++ 0.60 211,852 2275 0.98 38% 25% 82% 27%
C gcc 0.42 143,948 812 0.58 15% 26% 98% 2%
regex-redux
source secs mem gz cpu cpu load
C++ g++ 17.14 220,088 853 25.22 95% 3% 51% 1%
C gcc 1.45 155,768 1230 4.03 61% 64% 56% 100%
C++ g++

g++ (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406

C gcc

gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406