vs

 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 
 n-body± ±
 fannkuch-redux± 
 k-nucleotide †±±±
 fasta± ±
 mandelbrot± ±
 pidigits± 
 reverse-complement±1/8±
 regex-dna±±±
 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 
Ruby169.9456.82257,5921123  68% 71% 96% 65%
Python 3531.55140.741,123,020626  98% 94% 94% 94%
 spectral-norm 
Ruby379.9798.7042,696828  96% 96% 97% 97%
Python 3821.48209.7643,728437  98% 98% 98% 98%
 n-body 
Ruby662.33662.517,5041137  0% 1% 0% 100%
Python 3939.20939.505,5641181  1% 0% 0% 100%
 fannkuch-redux 
Ruby3,151.92810.0531,5121426  98% 97% 97% 98%
Python 33,587.04915.3640,096797  98% 97% 100% 97%
 k-nucleotide 
Ruby112.75112.79501,972449  1% 100% 0% 0% †
Python 3374.51124.40498,756647  59% 58% 87% 98% †
 fasta 
Ruby146.20151.337,520987  27% 30% 7% 39%
Python 3161.75166.415,576788  25% 27% 16% 34%
 mandelbrot 
Ruby2,010.04503.3370,3481019  100% 100% 100% 100%
Python 31,760.17475.3710,556777  90% 100% 90% 90%
 pidigits 
Ruby3.283.29639,156478  1% 3% 1% 100%
Python 32.402.416,600256  1% 2% 0% 100%
 reverse-complement 
Ruby8.358.36130,032255  0% 100% 1% 0%
Python 35.925.941,008,592325  1% 1% 1% 100%
 regex-dna 
Ruby34.1615.00291,124501  42% 41% 91% 54%
Python 322.9810.42269,120478  40% 48% 83% 55%
 fasta-redux 
Ruby1.181.638,132772  1% 90% 7% 2%
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.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

Home Page: Ruby is…

Download: Ruby 2.1.0 is released

Revised BSD license

  Home   Conclusions   License   Play