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
 binary-trees1/21/3
 spectral-norm1/2 
 n-body± ±
 regex-dna±1/3±
 k-nucleotide †±1/4
 fannkuch-redux± 
 fasta ±
 mandelbrot ±
 reverse-complement †1/21/3
 pidigits ±
 Ruby used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/21/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
 binary-trees 
Ruby176.2260.91240,6761123  95% 65% 63% 69%
Python 3481.66127.90838,044596  98% 93% 93% 94%
 spectral-norm 
Ruby392.71102.0140,236828  96% 97% 96% 96%
Python 3821.48209.7643,728437  98% 98% 98% 98%
 n-body 
Ruby673.78673.987,3041137  54% 0% 46% 1%
Python 3939.20939.505,5641181  1% 0% 0% 100%
 regex-dna 
Ruby27.989.46106,548529  64% 68% 92% 72%
Python 322.9810.42269,120478  40% 48% 83% 55%
 k-nucleotide 
Ruby109.07109.11503,176449  0% 1% 1% 100% †
Python 3279.6375.48225,4121937  93% 91% 92% 96% †
 fannkuch-redux 
Ruby3,110.09799.6428,5321426  97% 97% 98% 98%
Python 32,154.08546.3840,176944  98% 99% 98% 99%
 fasta 
Ruby156.52158.177,216987  18% 25% 23% 36%
Python 390.6190.645,608977  1% 1% 1% 100%
 mandelbrot 
Ruby1,974.54494.4062,6361019  100% 100% 100% 100%
Python 3954.62239.1040,852686  100% 100% 100% 100%
 reverse-complement 
Ruby8.388.39131,808255  0% 1% 0% 100% †
Python 34.302.92262,444800  4% 19% 99% 29% †
 pidigits 
Ruby11.1911.21147,748242  1% 0% 100% 1%
Python 32.212.216,784335  1% 100% 1% 0%
 fasta-redux 
Ruby1.191.217,904772  1% 2% 100% 2%
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.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

Home Page: Ruby is…

Download: Ruby 2.2.1 Released

Revised BSD license

  Home   Conclusions   License   Play