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 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 : 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 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 ±
 regex-dna1/21/4±
 spectral-norm1/2 ±
 reverse-complement1/2±±
 pidigits1/2 ±
 k-nucleotide±1/9±
 fannkuch-redux± ±
 mandelbrot± ±
 binary-trees±1/3±
 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/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 Java program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 n-body 
C++ g++9.129.138761545  0% 0% 100% 1%
Java24.3424.3124,1561424  1% 1% 1% 100%
 regex-dna 
C++ g++5.574.02176,492695  2% 63% 75% 1%
Java25.798.80729,244929  77% 80% 72% 66%
 spectral-norm 
C++ g++7.962.002,0241044  100% 100% 100% 100%
Java16.534.3026,476950  99% 96% 95% 96%
 reverse-complement 
C++ g++1.170.78247,3402275  23% 87% 11% 47%
Java2.911.44308,0601661  47% 31% 85% 43%
 pidigits 
C++ g++2.682.693,076682  0% 1% 2% 100%
Java4.174.0726,324938  3% 3% 4% 96%
 k-nucleotide 
C++ g++23.607.22132,7401252  78% 77% 76% 98%
Java35.2710.611,199,1841844  79% 78% 90% 88%
 fannkuch-redux 
C++ g++50.9313.021,4121440  100% 94% 99% 100%
Java67.5617.1325,8041282  100% 98% 99% 98%
 mandelbrot 
C++ g++22.975.7733,5921017  99% 99% 99% 100%
Java27.797.1287,832796  97% 99% 97% 97%
 binary-trees 
C++ g++16.575.08180,752892  81% 85% 82% 83%
Java19.645.88513,180926  95% 79% 87% 76%
 fasta-redux 
C++ g++2.102.101,1201474  100% 0% 0% 1%
Java1.991.9324,5881443  98% 2% 4% 3%
 fasta 
C++ g++4.284.281,1681105  1% 1% 1% 100% †
Java5.901.8231,6002457  80% 83% 80% 82% †

† 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.9.2 (Ubuntu 4.9.2-10ubuntu13)

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

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

Revised BSD license

  Home   Conclusions   License   Play