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 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 : 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 Python 3 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
 k-nucleotide1/9±
 binary-trees1/21/5
 spectral-norm± 
 fasta± ±
 regex-dna±1/2±
 fannkuch-redux± 
 n-body ±
 reverse-complement1/6±
 mandelbrot ±
 pidigits ±
 Ruby used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/91/9±±

± 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 Python 3 program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 k-nucleotide 
Ruby52.7817.28356,824996  69% 71% 69% 98%
Python 3488.50161.33364,488647  89% 60% 98% 56%
 binary-trees 
Ruby221.0176.21130,9361123  66% 97% 63% 65%
Python 3526.56139.26688,512626  93% 96% 96% 94%
 spectral-norm 
Ruby677.28175.9127,760828  96% 96% 96% 97%
Python 31,026.66258.4230,260437  99% 99% 99% 99%
 fasta 
Ruby235.44235.545,388987  47% 18% 37% 0%
Python 3241.56246.324,324788  30% 24% 15% 33%
 regex-dna 
Ruby37.6113.00115,136529  64% 61% 75% 91%
Python 323.8111.01248,260478  37% 72% 45% 64%
 fannkuch-redux 
Ruby4,979.101,283.8219,9161426  93% 98% 100% 98%
Python 34,000.061,012.0627,840797  99% 99% 98% 100%
 n-body 
Ruby1,585.811,586.245,4841137  0% 1% 38% 63%
Python 3984.27984.534,2521181  0% 100% 0% 0%
 reverse-complement 
Ruby11.0311.04129,928255  0% 1% 100% 0%
Python 36.536.55781,144325  0% 1% 0% 100%
 mandelbrot 
Ruby5,099.261,288.6480,676925  100% 99% 99% 99%
Python 31,837.41483.667,488777  100% 94% 93% 94%
 pidigits 
Ruby11.3111.3373,884242  1% 1% 1% 100%
Python 33.053.065,332256  1% 1% 0% 100%
 fasta-redux 
Ruby1.951.976,600772  97% 0% 1% 5%
No program

 4 : Are there other Ruby programs for these benchmarks?

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

 Ruby : the new Ruby 

online book Programming Ruby: The Pragmatic Programmers Guide

ruby 2.1.5p273 (2014-11-13 revision 48405) [i686-linux]

Home Page: Ruby is…

Download: Ruby 2.1.0 is released

Revised BSD license

  Home   Conclusions   License   Play