The Computer Language
Benchmarks Game

Free Pascal versus C++ g++ 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.

binary-trees
source secs mem gz busy cpu load
Free Pascal 3.06 132,852 1003 10.34 100% 89% 70% 80%
C++ g++ 3.92 114,136 809 12.90 82% 75% 73% 98%
pidigits
source secs mem gz busy cpu load
Free Pascal 1.73 2,436 530 1.80 99% 1% 1% 2%
C++ g++ 1.89 4,552 513 1.92 1% 100% 1% 0%
fannkuch-redux
source secs mem gz busy cpu load
Free Pascal 17.95 1,860 1050 71.73 100% 100% 100% 100%
C++ g++ 10.69 1,896 980 42.28 100% 100% 96% 100%
spectral-norm
source secs mem gz busy cpu load
Free Pascal 3.98 1,912 542 15.84 99% 99% 99% 99%
C++ g++ 1.98 2,268 1044 7.89 100% 99% 99% 99%
regex-redux
source secs mem gz busy cpu load
Free Pascal 3.88 103,124 1503 5.35 15% 15% 93% 14%
C++ g++ 1.83 203,932 1315 4.44 44% 99% 48% 51%
n-body
source secs mem gz busy cpu load
Free Pascal 22.36 8 1325 22.46 0% 100% 0% 0%
C++ g++ 7.92 1,116 1773 8.51 6% 1% 1% 100%
reverse-complement
source secs mem gz busy cpu load
Free Pascal 7.86 499,600 771 7.93 0% 1% 1% 100%
C++ g++ 1.61 996,244 1226 2.76 25% 24% 96% 27%
mandelbrot
source secs mem gz busy cpu load
Free Pascal 8.52 29,120 974 34.00 100% 100% 100% 100%
C++ g++ 1.51 25,828 1791 6.03 100% 100% 100% 100%
fasta
source secs mem gz busy cpu load
Free Pascal 10.96 8 1140 11.09 1% 0% 0% 100%
C++ g++ 1.46 2,216 2711 4.40 75% 75% 76% 75%
k-nucleotide
source secs mem gz busy cpu load
  No program contribute your program
C++ g++ 3.81 156,348 1624 11.78 70% 70% 73% 96%
Free Pascal

Free Pascal Compiler version 3.0.4 [2017/10/03] for x86_64

C++ g++

g++ (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008