The Computer Language
Benchmarks Game

Ada 2012 GNAT versus C gcc fastest programs

Back in April 2010, Russ Cox charitably suggested that only fannkuch-redux, fasta, k-nucleotide, mandlebrot, nbody, reverse-complement and spectral-norm were close to fair comparisons. As someone who implemented programming languages, his interest was "measuring the quality of the generated code when both compilers are presented with what amounts to the same program."

Differences in approach - to memory management, parallel programming, regex, arbitrary precision arithmetic, implementation technique - don't fit in that kind-of fair comparison — but we still have to deal with them.

These are only the fastest programs. There may be additional measurements for programs which seem more-like a fair comparison to you. Always look at the source code.

pidigits
source secs mem gz busy cpu load
Ada 2012 GNAT 1.75 4,580 1130 1.78 100% 0% 2% 0%
C gcc 1.75 2,660 452 2.02 1% 100% 14% 1%
spectral-norm
source secs mem gz busy cpu load
Ada 2012 GNAT 2.00 4,320 2770 7.90 99% 99% 99% 98%
C gcc 1.98 1,252 1139 7.88 99% 100% 99% 99%
fannkuch-redux
source secs mem gz busy cpu load
Ada 2012 GNAT 9.89 4,336 2113 39.46 100% 100% 100% 100%
C gcc 8.61 880 910 33.96 95% 100% 99% 100%
n-body
source secs mem gz busy cpu load
Ada 2012 GNAT 9.04 1,896 2617 9.32 1% 100% 3% 0%
C gcc 7.49 8 1391 7.56 0% 0% 100% 1%
reverse-complement
source secs mem gz busy cpu load
Ada 2012 GNAT 3.87 793,072 3283 4.44 73% 39% 1% 1%
C gcc 1.78 994,532 1438 4.02 42% 96% 46% 43%
k-nucleotide
source secs mem gz busy cpu load
Ada 2012 GNAT 11.60 258,468 4908 25.25 25% 82% 25% 86%
C gcc 5.01 130,104 1506 16.41 84% 100% 84% 59%
binary-trees
source secs mem gz busy cpu load
Ada 2012 GNAT 9.64 202,248 2107 33.29 82% 84% 90% 89%
C gcc 3.48 168,744 809 11.47 99% 74% 79% 79%
fasta
source secs mem gz busy cpu load
Ada 2012 GNAT 4.11 1,960 2221 4.20 0% 100% 1% 0%
C gcc 1.36 2,912 2268 5.42 99% 100% 99% 99%
mandelbrot
source secs mem gz busy cpu load
Ada 2012 GNAT 5.59 35,952 1819 22.19 99% 100% 99% 99%
C gcc 1.65 26,204 1135 6.56 99% 100% 99% 99%
regex-redux
source secs mem gz busy cpu load
Ada 2012 GNAT 6.97 154,328 3640 19.90 59% 70% 74% 83%
C gcc 1.46 152,236 1397 3.43 43% 100% 45% 48%
Ada 2012 GNAT

GNATMAKE 8.3.0

gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0

C gcc

gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0