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/10±
 binary-trees1/21/4
 spectral-norm1/2 
 n-body± ±
 fasta± ±
 fannkuch-redux± 
 regex-dna±1/2±
 mandelbrot± ±
 reverse-complement±1/8±
 pidigits ±
 Ruby used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/101/101/2±±

± 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 
Ruby37.3512.36457,396996  70% 69% 97% 68%
Python 3374.51124.40498,756647  59% 58% 87% 98%
 binary-trees 
Ruby169.6857.70257,3881123  65% 97% 67% 67%
Python 3531.55140.741,123,020626  98% 94% 94% 94%
 spectral-norm 
Ruby391.41102.2041,320828  96% 96% 95% 95%
Python 3821.48209.7643,728437  98% 98% 98% 98%
 n-body 
Ruby640.09640.267,1601137  1% 0% 0% 100%
Python 3939.20939.505,5641181  1% 0% 0% 100%
 fasta 
Ruby148.59148.667,652987  18% 23% 32% 29%
Python 3161.75166.415,576788  25% 27% 16% 34%
 fannkuch-redux 
Ruby3,197.06828.6030,5921426  96% 98% 96% 97%
Python 33,587.04915.3640,096797  98% 97% 100% 97%
 regex-dna 
Ruby28.739.65118,660529  66% 65% 67% 100%
Python 322.9810.42269,120478  40% 48% 83% 55%
 mandelbrot 
Ruby1,865.72467.2365,1761019  100% 100% 100% 100%
Python 31,760.17475.3710,556777  90% 100% 90% 90%
 reverse-complement 
Ruby8.218.22132,256255  1% 0% 0% 100%
Python 35.925.941,008,592325  1% 1% 1% 100%
 pidigits 
Ruby10.9610.9876,712240  0% 1% 100% 1%
Python 32.402.416,600256  1% 2% 0% 100%
 fasta-redux 
Ruby1.141.148,452772  4% 32% 1% 71%
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) [x86_64-linux]

Home Page: Ruby is…

Download: Ruby 2.1.0 is released

Revised BSD license

  Home   Conclusions   License   Play