The Computer Language
Benchmarks Game

Ruby programs versus Python 3

by benchmark task performance

binary-trees
source secs mem gz cpu cpu load
Ruby 58.72 192,132 1123 166.36 67% 61% 68% 90%
Python 3 126.07 831,740 596 474.55 93% 93% 93% 99%
spectral-norm
source secs mem gz cpu cpu load
Ruby 141.49 50,156 835 544.76 96% 97% 96% 97%
Python 3 180.01 55,892 437 714.86 99% 100% 99% 100%
n-body
source secs mem gz cpu cpu load
Ruby 723.69 8,916 1137 723.48 25% 86% 1% 9%
Python 3 836.27 7,756 1181 836.06 0% 1% 1% 100%
pidigits
source secs mem gz cpu cpu load
Ruby 3.14 477,092 478 3.12 0% 100% 2% 1%
Python 3 3.41 9,992 382 3.40 1% 2% 100% 1%
fasta
source secs mem gz cpu cpu load
Ruby 108.36 107,984 973 108.32 7% 10% 75% 10%
Python 3 113.03 7,860 977 112.99 1% 100% 0% 1%
reverse-complement
source secs mem gz cpu cpu load
Ruby 4.03 505,656 509 7.14 51% 83% 37% 9%
Python 3 2.93 265,636 800 4.28 80% 46% 21% 2%
k-nucleotide
source secs mem gz cpu cpu load
Ruby 101.95 381,312 852 367.82 84% 98% 85% 95%
Python 3 72.35 229,040 1937 268.72 98% 94% 91% 94%
fannkuch-redux
source secs mem gz cpu cpu load
Ruby 710.58 33,348 1426 2,761.73 99% 99% 95% 97%
Python 3 501.72 54,708 944 1,967.92 98% 97% 100% 99%
mandelbrot
source secs mem gz cpu cpu load
Ruby 463.95 69,656 1019 1,852.06 100% 100% 100% 100%
Python 3 250.62 52,752 686 1,000.26 100% 100% 100% 100%
regex-redux
source secs mem gz cpu cpu load
Ruby 28.80 309,760 424 28.77 15% 48% 20% 19%
Python 3 14.87 433,868 486 28.02 32% 45% 84% 29%
Ruby

ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

Python 3

Python 3.6.0 (default, Feb 5 2017, 10:29:14) [GCC 5.4.0 20160609] on linux
--enable-optimizations
make profile-opt