/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® quad-core |
Each chart bar shows, for one unidentified benchmark, how much the fastest C gcc program used compared to the fastest C++ g++ program.
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.
Each table row shows, for one named benchmark, how much the fastest C gcc program used compared to the fastest C++ g++ program.
| C gcc used what fraction? used how many times more? | ||||
|---|---|---|---|---|
| Benchmark | Time | Memory | Code | |
| binary-trees | 1/2 | 1/2 | ± | |
| regex-dna | 1/2 | 2× | 4× | |
| reverse-complement | ± | ± | 1/3 | |
| pidigits | ± | 1/2 | 1/2 | |
| spectral-norm | ± | 2× | 1/2 | |
| n-body | ± | 1/2 | ± | |
| fasta-redux | ± | 1/2 | ± | |
| fannkuch-redux | ± | 1/3 | ± | |
| mandelbrot | ± | ± | ± | |
| fasta | ± | 1/3 | ± | |
| k-nucleotide | 2× | ± | 2× | |
| C gcc used what fraction? used how many times more? | |||||||
|---|---|---|---|---|---|---|---|
| Time-used | |- | |--- | 25% | median | 75% | ---| | -| |
| (Elapsed secs) | 1/2 | 1/2 | ± | ± | ± | 2× | 2× |
± read the measurements and then read the program source code.
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 gcc program are shown for comparison against measurements of the fastest C++ g++ program.
| Program Source Code | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| binary-trees | |||||
| C gcc | 15.71 | 4.79 | 155,788 | 850 | 93% 67% 78% 94% |
| C++ g++ | 32.34 | 9.25 | 360,404 | 892 | 89% 79% 95% 88% |
| regex-dna | |||||
| C gcc | 5.76 | 2.50 | 292,128 | 2579 | 69% 68% 49% 46% |
| C++ g++ | 5.83 | 4.10 | 173,632 | 695 | 0% 60% 82% 0% |
| reverse-complement | |||||
| C gcc | 0.80 | 0.56 | 248,716 | 741 | 16% 20% 44% 73% |
| C++ g++ | 1.22 | 0.77 | 245,692 | 2275 | 12% 55% 49% 46% |
| pidigits | |||||
| C gcc | 1.72 | 1.73 | 936 | 448 | 0% 0% 1% 100% |
| C++ g++ | 2.29 | 2.30 | 1,648 | 682 | 0% 0% 0% 100% |
| spectral-norm | |||||
| C gcc | 7.87 | 1.98 | 748 | 569 | 99% 99% 99% 100% |
| C++ g++ | 10.02 | 2.52 | 492 | 1044 | 100% 100% 100% 100% |
| n-body | |||||
| C gcc | 9.33 | 9.34 | 432 | 1490 | 100% 0% 0% 1% |
| C++ g++ | 10.07 | 10.07 | 828 | 1763 | 0% 0% 1% 100% |
| fasta-redux | |||||
| C gcc | 1.60 | 1.61 | 372 | 1321 | 0% 0% 99% 1% |
| C++ g++ | 1.70 | 1.71 | 832 | 1474 | 0% 0% 1% 100% |
| fannkuch-redux | |||||
| C gcc | 48.38 | 12.42 | 412 | 1557 | 98% 93% 98% 100% |
| C++ g++ | 47.95 | 12.29 | 1,236 | 1440 | 100% 93% 100% 98% |
| mandelbrot | |||||
| C gcc | 23.52 | 5.89 | 25,976 | 879 | 100% 100% 100% 100% |
| C++ g++ | 19.29 | 5.01 | 32,288 | 726 | 95% 99% 96% 95% |
| fasta | |||||
| C gcc | 5.96 | 5.97 | 372 | 1221 | 0% 0% 0% 100% |
| C++ g++ | 4.16 | 4.16 | 1,072 | 1286 | 0% 0% 100% 0% |
| k-nucleotide | |||||
| C gcc | 44.64 | 16.00 | 180,380 | 2280 | 35% 50% 98% 97% |
| C++ g++ | 25.89 | 7.79 | 155,916 | 1252 | 78% 80% 78% 98% |
Remember - those are just the fastest C gcc and C++ g++ programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for C gcc.
Maybe one of those other C gcc programs is fastest on a different OS/machine.
Remember - those are just the fastest C gcc and C++ g++ 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.
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Online book: The C Book
Online book: Looking for 4x speedups? SSE to the rescue! pdf slides
Home Page: http://gcc.gnu.org/
Download: ftp://ftp.gnu.org/pub/gnu/gcc/