vs

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

Each chart bar shows, for one unidentified benchmark, how much the fastest C++ g++ program used compared to the fastest Java 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 : Are the C++ g++ programs faster? Approximately.

Each table row shows, for one named benchmark, how much the fastest C++ g++ program used compared to the fastest Java 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
 n-body1/3 ±
 binary-trees1/31/3
 regex-dna1/21/4±
 reverse-complement1/2±±
 spectral-norm1/2 ±
 k-nucleotide1/21/7±
 pidigits1/2 ±
 fannkuch-redux± ±
 mandelbrot± ±
 fasta-redux± ±
 fasta † 1/2
 C++ g++ used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/31/31/21/2±±

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

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

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

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 Java program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 n-body 
C++ g++9.089.093361544  0% 100% 1% 0%
Java24.5024.4815,6561424  0% 100% 1% 0%
 binary-trees 
C++ g++15.895.05179,668892  73% 70% 97% 77%
Java17.7512.78471,136584  77% 15% 15% 34%
 regex-dna 
C++ g++5.383.83171,652695  1% 65% 76% 2%
Java26.449.20713,236929  80% 66% 77% 65%
 reverse-complement 
C++ g++1.150.75247,0082275  11% 87% 30% 29%
Java3.161.63296,1361661  77% 24% 39% 58%
 spectral-norm 
C++ g++7.972.009241044  100% 100% 100% 100%
Java16.564.2916,460950  96% 96% 99% 96%
 k-nucleotide 
C++ g++23.447.22139,1361252  76% 76% 78% 97%
Java45.3313.06923,0681630  81% 83% 85% 99%
 pidigits 
C++ g++2.682.681,452682  0% 0% 1% 100%
Java4.154.0418,352938  16% 84% 1% 1%
 fannkuch-redux 
C++ g++50.0312.881,0361440  99% 99% 100% 99%
Java68.0417.2515,6961282  99% 99% 97% 99%
 mandelbrot 
C++ g++23.465.8932,1801017  100% 100% 100% 100%
Java27.176.9573,488796  97% 97% 99% 98%
 fasta-redux 
C++ g++2.162.176201474  1% 100% 0% 0%
Java2.031.9815,8961443  82% 19% 2% 2%
 fasta 
C++ g++4.214.228721286  0% 100% 0% 1% †
Java5.341.7229,4842457  69% 75% 73% 96% †

† 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 Java 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 Java 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