The Computer Language
22.01 Benchmarks Game

C++ g++ versus C gcc fastest programs

Always look at the source code. These are only the fastest programs.

If they are manually vectorized SIMD, does the host language matter? You might not be interested in the most optimised programs.

Look at "mandelbrot" or "spectral-norm" or other measurement tables. Look at the other programs. Choose which programs you want to compare.

fannkuch-redux
source secs mem gz busy cpu load
C++ g++ 3.26 1,992 1528 12.94 98% 100% 100% 100%
C gcc 7.58 1,048 910 29.67 99% 100% 94% 99%
k-nucleotide
source secs mem gz busy cpu load
C++ g++ 1.96 156,492 1631 5.97 69% 98% 68% 69%
C gcc 3.96 130,000 1506 12.52 74% 54% 99% 90%
binary-trees
source secs mem gz busy cpu load
C++ g++ 0.94 176,440 890 3.33 85% 87% 83% 100%
C gcc 1.58 168,780 809 4.58 100% 62% 67% 62%
mandelbrot
source secs mem gz busy cpu load
C++ g++ 0.84 34,800 3542 3.28 98% 99% 98% 98%
C gcc 1.30 30,924 1135 5.18 100% 100% 100% 100%
fasta
source secs mem gz busy cpu load
C++ g++ 0.77 2,676 2751 1.59 99% 38% 66% 4%
C gcc 0.78 1,244 1463 0.82 0% 1% 4% 100%
n-body
source secs mem gz busy cpu load
C++ g++ 2.17 992 1927 2.23 1% 0% 100% 1%
C gcc 2.13 992 1633 2.22 1% 1% 2% 100%
pidigits
source secs mem gz busy cpu load
C++ g++ 0.59 5,024 986 2.36 98% 100% 100% 100%
C gcc 0.56 2,440 1090 2.26 100% 100% 100% 100%
regex-redux
source secs mem gz busy cpu load
C++ g++ 1.11 203,844 1315 3.43 76% 63% 100% 71%
C gcc 0.80 152,240 1397 2.06 97% 55% 50% 56%
reverse-complement
source secs mem gz busy cpu load
C++ g++ 0.64 499,692 2093 0.64 0% 0% 0% 100%
C gcc 0.41 499,072 1965 0.59 15% 90% 22% 17%
spectral-norm
source secs mem gz busy cpu load
C++ g++ 0.72 1,296 1044 2.86 99% 100% 100% 99%
C gcc 0.41 1,016 1197 1.60 98% 95% 98% 95%
C++ g++

g++ (Ubuntu 11.2.0-7ubuntu2) 11.2.0

C gcc

gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0