The Computer Language
Benchmarks Game

Ruby programs versus Python 3

by benchmark task performance

binary-trees
source secs mem gz cpu cpu load
Ruby 54.24 510,868 1078 153.99 73% 98% 67% 72%
Python 3 86.90 451,548 581 306.31 89% 97% 87% 89%
spectral-norm
source secs mem gz cpu cpu load
Ruby 141.49 50,156 835 544.76 96% 97% 96% 97%
Python 3 188.83 54,524 437 750.46 99% 100% 100% 99%
pidigits
source secs mem gz cpu cpu load
Ruby 3.14 477,092 478 3.12 0% 100% 2% 1%
Python 3 3.51 10,344 382 3.50 0% 2% 1% 100%
n-body
source secs mem gz cpu cpu load
Ruby 723.69 8,916 1137 723.48 25% 86% 1% 9%
Python 3 787.02 7,744 1181 786.82 0% 1% 0% 100%
fasta
source secs mem gz cpu cpu load
Ruby 108.36 107,984 973 108.32 7% 10% 75% 10%
Python 3 110.91 8,024 977 110.87 100% 1% 1% 1%
k-nucleotide
source secs mem gz cpu cpu load
Ruby 101.95 381,312 852 367.82 84% 98% 85% 95%
Python 3 84.73 221,028 1937 276.97 97% 93% 91% 91%
reverse-complement
source secs mem gz cpu cpu load
Ruby 4.03 505,656 509 7.14 51% 83% 37% 9%
Python 3 2.82 265,428 800 4.18 46% 32% 20% 54%
fannkuch-redux
source secs mem gz cpu cpu load
Ruby 710.58 33,348 1426 2,761.73 99% 99% 95% 97%
Python 3 483.79 51,896 944 1,880.10 97% 94% 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 273.43 53,416 686 1,091.35 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.86 439,208 486 27.92 46% 77% 35% 31%
Ruby

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

Python 3

Python 3.6.1 (default, Apr 18 2017, 10:33:41)
[GCC 6.3.0 20170406]
--enable-optimizations --with-lto
make profile-opt