The Computer Language
Benchmarks Game

C gcc versus C++ g++ fastest programs

Always look at the source code.

These are only the fastest programs. Do some of them use manually vectorized SIMD? Look at the other programs. They may seem more-like a fair comparison to you.

spectral-norm
source secs mem gz busy cpu load
C gcc 0.40 872 1197 1.58 100% 100% 100% 98%
C++ g++ 0.72 1,192 1044 2.85 99% 99% 100% 100%
regex-redux
source secs mem gz busy cpu load
C gcc 0.80 152,172 1397 2.01 52% 99% 48% 53%
C++ g++ 1.10 203,924 1315 3.43 63% 77% 71% 100%
pidigits
source secs mem gz busy cpu load
C gcc 0.59 2,444 1090 2.37 100% 100% 100% 98%
C++ g++ 0.66 5,152 986 2.63 100% 100% 100% 100%
fasta
source secs mem gz busy cpu load
C gcc 0.78 1,156 1463 0.78 0% 0% 0% 100%
C++ g++ 0.77 2,504 2751 1.52 64% 0% 99% 37%
n-body
source secs mem gz busy cpu load
C gcc 2.18 768 1633 2.19 0% 100% 0% 0%
C++ g++ 2.12 764 1927 2.17 0% 2% 100% 0%
mandelbrot
source secs mem gz busy cpu load
C gcc 1.27 31,792 1135 5.08 100% 100% 99% 100%
C++ g++ 0.84 34,780 3542 3.27 99% 98% 98% 96%
binary-trees
source secs mem gz busy cpu load
C gcc 1.54 168,832 809 4.35 60% 67% 57% 100%
C++ g++ 0.94 176,428 1122 3.39 86% 88% 100% 85%
reverse-complement
source secs mem gz busy cpu load
C gcc 0.86 712,208 820 1.27 99% 28% 1% 19%
C++ g++ 0.52 1,788 1853 0.52 0% 98% 0% 2%
k-nucleotide
source secs mem gz busy cpu load
C gcc 3.72 130,260 1506 12.07 100% 89% 78% 57%
C++ g++ 1.93 156,548 1631 5.88 69% 93% 69% 75%
fannkuch-redux
source secs mem gz busy cpu load
C gcc 7.58 872 910 29.61 100% 98% 99% 93%
C++ g++ 3.29 1,892 1528 13.06 100% 100% 100% 97%
C gcc

gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0

C++ g++

g++ (Ubuntu 10.3.0-1ubuntu1) 10.3.0