1 : At a glance - Are the C++ g++ programs faster?

Each chart bar shows, for one unidentified benchmark, how much the fastest C++ g++ program used compared to the fastest Python 3 program.

(Memory use is only compared for tasks that require memory to be allocated.)


These are not the only compilers and interpreters. These are not the only programs that could be written. These are not the only tasks that could be solved. These are just 10 tiny examples.

 2 : Approximately - Are the C++ g++ programs faster?

Each table row shows, for one named benchmark, how much the fastest C++ g++ program used compared to the fastest Python 3 program.

(Memory use is only compared for tasks that require memory to be allocated.)

 C++ g++ used what fraction? used how many times more? 
Benchmark Time Memory Code
 spectral-norm1/126 
 n-body1/109 ±
 fannkuch-redux1/51 
 mandelbrot1/47 ±
 binary-trees1/251/3±
 fasta †1/20 ±
 k-nucleotide1/11±1/2
 reverse-complement1/5±
 regex-dna1/3±±
 pidigits± 
 C++ g++ used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/1261/1261/511/221/51/2±

† possible mismatch - one-core program compared to multi-core program.

± read the measurements and then read the program source code.

 3 : Measurements - Are the C++ g++ programs faster?

These are not the only tasks that could be solved. These are just 10 tiny examples. These are not the only compilers and interpreters. These are not the only programs that could be written.

For each named benchmark, measurements of the fastest C++ g++ program are shown for comparison against measurements of the fastest Python 3 program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 spectral-norm 
C++ g++7.972.009241044  100% 100% 100% 100%
Python 31,004.46252.9230,320437  99% 100% 99% 99%
 n-body 
C++ g++9.089.093361544  0% 100% 1% 0%
Python 3993.47993.704,2401181  0% 0% 100% 1%
 fannkuch-redux 
C++ g++50.0312.881,0361440  99% 99% 100% 99%
Python 32,582.98654.6128,068944  100% 99% 98% 98%
 mandelbrot 
C++ g++23.465.8932,1801017  100% 100% 100% 100%
Python 31,106.61277.2728,372686  100% 100% 100% 100%
 binary-trees 
C++ g++15.895.05179,668892  73% 70% 97% 77%
Python 3470.42125.06470,428596  93% 97% 94% 94%
 fasta 
C++ g++2.312.328721543  1% 0% 0% 100% †
Python 3127.5445.962,479,9041933  76% 65% 78% 80% †
 k-nucleotide 
C++ g++23.447.22139,1361252  76% 76% 78% 97%
Python 3291.9475.78148,1921937  97% 97% 100% 97%
 reverse-complement 
C++ g++1.150.75247,0082275  11% 87% 30% 29%
Python 35.453.72259,780800  30% 1% 72% 47%
 regex-dna 
C++ g++5.383.83171,652695  1% 65% 76% 2%
Python 323.4910.58253,208478  47% 39% 94% 43%
 pidigits 
C++ g++2.682.681,452682  0% 0% 1% 100%
Python 32.742.745,400335  0% 1% 100% 0%
 fasta-redux 
C++ g++0.030.03?1474  0% 0% 25% 100%
No program

† possible mismatch - one-core program compared to multi-core program.

 4 : Are there other C++ g++ programs for these benchmarks?

Remember - those are just the fastest C++ g++ and Python 3 programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for C++ g++.

Maybe one of those other C++ g++ programs is fastest on a different OS/machine.

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest C++ g++ and Python 3 programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 C++ g++ : c plus objects plus generics 

C++ 1991-2006, Bjarne Stroustrup (pdf)

Online book: Looking for 4x speedups? SSE to the rescue! pdf slides

gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

Home Page: http://gcc.gnu.org/

Download: ftp://ftp.gnu.org/pub/gnu/gcc/

Revised BSD license

  Home   Conclusions   License   Play