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

† possible mismatch - one-core program compared to multi-core program.

± 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 
Ruby193.7567.48114,5881123  63% 63% 66% 96%
Python 3468.39124.43465,940596  95% 94% 96% 93%
 spectral-norm 
Ruby648.25168.1425,624828  96% 97% 97% 97%
Python 31,026.66258.4230,260437  99% 99% 99% 99%
 regex-dna 
Ruby36.1312.28348,464501  65% 78% 70% 82%
Python 323.8111.01248,260478  37% 72% 45% 64%
 n-body 
Ruby1,491.561,491.955,0841137  22% 0% 79% 1%
Python 3984.27984.534,2521181  0% 100% 0% 0%
 fannkuch-redux 
Ruby4,399.701,129.0118,5281426  98% 96% 100% 97%
Python 32,470.70633.3727,972944  99% 98% 99% 98%
 k-nucleotide 
Ruby184.06187.14501,072449  6% 93% 0% 1% †
Python 3294.0977.49141,2161937  97% 94% 95% 97% †
 reverse-complement 
Ruby10.4510.46129,336255  0% 0% 1% 100% †
Python 35.063.49258,604800  46% 1% 27% 74% †
 mandelbrot 
Ruby4,203.221,052.6051,4081019  100% 100% 100% 100%
Python 31,301.03326.0228,580686  100% 100% 100% 100%
 pidigits 
Ruby11.2011.22147,624240  82% 1% 19% 1%
Python 32.742.745,388335  0% 100% 1% 0%
 fasta 
Ruby240.42240.855,124987  45% 20% 29% 9% †
Python 3127.4746.442,478,0681933  61% 82% 65% 77% †
 fasta-redux 
Ruby1.961.975,704772  97% 1% 1% 3%
No program

† possible mismatch - one-core program compared to multi-core 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