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++ 8.23 1,856 1763 8.23 100% 1% 1% 0%
C gcc 9.12 1,176 1490 9.12 1% 100% 2% 2%
mandelbrot
source secs mem gz cpu cpu load
C++ g++ 1.64 27,636 1002 6.51 100% 99% 100% 99%
C gcc 1.64 29,424 1135 6.53 99% 100% 100% 100%
spectral-norm
source secs mem gz cpu cpu load
C++ g++ 2.02 1,332 1044 7.91 99% 99% 99% 99%
C gcc 2.00 1,300 569 7.89 99% 99% 100% 99%
fasta
source secs mem gz cpu cpu load
C++ g++ 1.35 1,952 2711 4.18 79% 78% 78% 79%
C gcc 1.32 2,912 2268 5.25 100% 99% 100% 99%
binary-trees
source secs mem gz cpu cpu load
C++ g++ 2.55 135,568 809 7.99 85% 96% 69% 66%
C gcc 2.44 133,956 836 7.57 80% 65% 68% 100%
pidigits
source secs mem gz cpu cpu load
C++ g++ 1.88 4,276 513 1.88 0% 100% 1% 0%
C gcc 1.74 2,716 452 1.74 100% 1% 1% 2%
regex-redux
source secs mem gz cpu cpu load
C++ g++ 1.61 203,572 1315 4.18 100% 52% 57% 54%
C gcc 1.48 152,352 1230 4.05 59% 99% 57% 61%
k-nucleotide
source secs mem gz cpu cpu load
C++ g++ 7.75 165,180 1276 26.02 80% 96% 82% 79%
C gcc 6.67 130,160 1506 19.33 76% 50% 92% 75%
fannkuch-redux
source secs mem gz cpu cpu load
C++ g++ 10.61 2,044 980 41.90 100% 96% 100% 100%
C gcc 8.66 980 910 34.22 100% 97% 100% 100%
reverse-complement
source secs mem gz cpu cpu load
C++ g++ 0.64 247,800 2280 1.03 89% 22% 31% 30%
C gcc 0.48 200,492 820 0.66 4% 19% 25% 98%
C++ g++

g++ (Ubuntu 7.2.0-8ubuntu3) 7.2.0

C gcc

gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0