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/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 : 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 
Ruby193.7567.48114,5881123  63% 63% 66% 96%
Python 3470.42125.06470,428596  93% 97% 94% 94%
 spectral-norm 
Ruby648.25168.1425,624828  96% 97% 97% 97%
Python 31,004.46252.9230,320437  99% 100% 99% 99%
 regex-dna 
Ruby36.1312.28348,464501  65% 78% 70% 82%
Python 323.4910.58253,208478  47% 39% 94% 43%
 n-body 
Ruby1,491.561,491.955,0841137  22% 0% 79% 1%
Python 3993.47993.704,2401181  0% 0% 100% 1%
 fannkuch-redux 
Ruby4,399.701,129.0118,5281426  98% 96% 100% 97%
Python 32,582.98654.6128,068944  100% 99% 98% 98%
 k-nucleotide 
Ruby184.06187.14501,072449  6% 93% 0% 1% †
Python 3291.9475.78148,1921937  97% 97% 100% 97% †
 reverse-complement 
Ruby10.4510.46129,336255  0% 0% 1% 100% †
Python 35.453.72259,780800  30% 1% 72% 47% †
 mandelbrot 
Ruby4,203.221,052.6051,4081019  100% 100% 100% 100%
Python 31,106.61277.2728,372686  100% 100% 100% 100%
 pidigits 
Ruby11.2011.22147,624240  82% 1% 19% 1%
Python 32.742.745,400335  0% 1% 100% 0%
 fasta 
Ruby240.42240.855,124987  45% 20% 29% 9% †
Python 3127.5445.962,479,9041933  76% 65% 78% 80% †
 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