/mobile Handheld Friendly website

vs

 1 : Are the Ruby programs faster? At a glance.

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

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

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

 Ruby used what fraction? used how many times more? 
Benchmark Time Memory Code
 pidigits 1/3
 regex-dna±1/2
 k-nucleotide1/3
 reverse-complement10×1/21/9
 binary-trees21×1/2
 fasta52× ±
 spectral-norm72× 1/3
 fasta-redux83× 1/2
 fannkuch-redux117× 1/3
 n-body158× ±
 mandelbrot164× 1/3
 Ruby used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)52×100×164×164×

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

 3 : Are the Ruby 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 Ruby 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
 pidigits 
Ruby11.0811.1172,408240  0% 0% 1% 100%
C++ g++2.682.681,464682  1% 1% 0% 100%
 regex-dna 
Ruby28.1428.15162,792442  0% 1% 1% 100%
C++ g++5.905.92174,664695  1% 1% 1% 100%
 k-nucleotide 
Ruby189.00192.22499,732449  0% 1% 0% 100%
C++ g++23.8523.87137,1241252  1% 1% 0% 100%
 reverse-complement 
Ruby10.6310.64127,856255  0% 1% 0% 100%
C++ g++1.061.07245,4082275  0% 0% 2% 99%
 binary-trees 
Ruby222.74222.85557,644413  0% 1% 1% 100%
C++ g++10.3610.3867,008919  0% 1% 0% 100%
 fasta 
Ruby218.22220.085,380987  1% 1% 1% 100%
C++ g++4.224.238841286  1% 0% 0% 100%
 spectral-norm 
Ruby567.84568.016,624326  1% 1% 1% 100%
C++ g++7.927.939361044  0% 1% 1% 100%
 fasta-redux 
Ruby176.52179.33191,692772  1% 1% 0% 100%
C++ g++2.162.166321474  0% 0% 2% 100%
 fannkuch-redux 
Ruby3,192.973,194.075,284384  0% 1% 1% 100%
C++ g++27.2227.232961150  1% 0% 0% 100%
 n-body 
Ruby1,433.221,433.665,2881137  0% 0% 0% 100%
C++ g++9.069.073441545  2% 3% 2% 100%
 mandelbrot 
Ruby3,857.693,859.075,288307  0% 1% 1% 100%
C++ g++23.4523.4632,0881017  0% 0% 1% 100%

 4 : Are there other Ruby programs for these benchmarks?

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

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

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest Ruby 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.

 Ruby : the new Ruby 

online book Programming Ruby: The Pragmatic Programmers Guide

ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux]

Home Page: Ruby is…

Download: Ruby 2.1.0 is released

Revised BSD license

  Home   Conclusions   License   Play