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

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 : Approximately - Are the Ruby programs faster?

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

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

 3 : Measurements - Are the Ruby programs faster?

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 
Ruby181.10181.20114,296402  1% 0% 1% 100%
Python 3456.23456.60470,132596  1% 1% 0% 100%
 spectral-norm 
Ruby585.28585.445,800326  0% 1% 1% 100%
Python 3950.08950.334,972328  0% 0% 1% 100%
 k-nucleotide 
Ruby182.68182.73501,036449  0% 0% 1% 100%
Python 3295.95296.24152,2961937  1% 1% 1% 100%
 fannkuch-redux 
Ruby2,722.152,722.875,036384  0% 0% 1% 100%
Python 32,467.602,468.3128,000944  1% 1% 0% 100%
 regex-dna 
Ruby28.6228.63152,388442  0% 1% 1% 100%
Python 323.5623.68234,048478  1% 1% 0% 100%
 n-body 
Ruby1,467.711,468.115,1241137  0% 1% 1% 100%
Python 3991.99992.224,2321181  1% 0% 1% 100%
 reverse-complement 
Ruby10.3810.40129,084255  0% 1% 0% 100%
Python 35.235.25258,596800  0% 2% 1% 100%
 fasta 
Ruby241.85241.945,080987  0% 1% 1% 100%
Python 3108.42108.464,328977  0% 0% 1% 100%
 mandelbrot 
Ruby251.94252.015,080307  0% 1% 1% 100%
Python 371.2171.3028,308686  1% 1% 1% 100%
 pidigits 
Ruby11.1811.20148,712240  0% 0% 1% 100%
Python 32.732.745,452335  0% 2% 1% 100%
 fasta-redux 
Ruby1.941.965,704772  1% 4% 1% 99%
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) [i686-linux]

Home Page: Ruby is…

Download: Ruby 2.2.1 Released

Revised BSD license

  Home   Conclusions   License   Play