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

± 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 
Ruby165.21165.40240,392402  0% 1% 1% 100%
Python 3440.15440.65836,008596  1% 1% 0% 100%
 spectral-norm 
Ruby318.82318.909,108326  1% 0% 1% 100%
Python 3807.16807.406,480328  1% 0% 0% 100%
 k-nucleotide 
Ruby108.59108.62501,712449  0% 1% 1% 100%
Python 3269.61272.54213,8601937  1% 1% 1% 100%
 n-body 
Ruby689.90690.087,0721137  1% 0% 0% 100%
Python 3876.16876.397,7641228  1% 0% 0% 100%
 regex-dna 
Ruby24.3224.33145,900442  0% 1% 0% 100%
Python 323.1523.26254,316478  1% 1% 0% 100%
 fannkuch-redux 
Ruby2,350.012,350.707,048384  1% 0% 0% 100%
Python 31,974.641,975.3839,988944  1% 1% 0% 100%
 fasta 
Ruby155.80157.237,212987  1% 1% 1% 99%
Python 395.9796.005,628977  0% 1% 0% 100%
 mandelbrot 
Ruby1,910.361,911.0162,7361019  0% 1% 1% 100%
Python 3968.93969.3540,388686  1% 1% 1% 100%
 reverse-complement 
Ruby8.378.38131,592255  1% 0% 0% 100%
Python 34.194.20262,356800  1% 1% 1% 100%
 pidigits 
Ruby11.2011.22147,884242  0% 1% 1% 100%
Python 32.192.196,808335  1% 1% 0% 100%
 fasta-redux 
Ruby1.191.207,900772  1% 2% 2% 100%
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