The Computer Language
Benchmarks Game

Ruby programs versus Python 3

by benchmark task performance

binary-trees
source secs mem gz cpu cpu load
Ruby 50.97 367,192 1083 140.99 65% 62% 92% 59%
Python 3 93.55 280,624 589 337.74 92% 89% 87% 93%
spectral-norm
source secs mem gz cpu cpu load
Ruby 125.65 52,368 835 484.43 96% 97% 97% 96%
Python 3 180.97 15,876 443 720.51 100% 100% 100% 100%
n-body
source secs mem gz cpu cpu load
Ruby 641.41 8,848 1137 641.26 8% 93% 0% 0%
Python 3 838.39 10,324 1196 838.20 95% 1% 5% 0%
regex-redux
source secs mem gz cpu cpu load
Ruby 13.14 314,092 751 7.85 90% 41% 41% 47%
Python 3 15.22 447,324 512 27.44 25% 33% 32% 91%
pidigits
source secs mem gz cpu cpu load
Ruby 2.97 306,652 485 2.96 1% 0% 3% 100%
Python 3 3.43 12,716 386 3.43 100% 1% 1% 0%
fannkuch-redux
source secs mem gz cpu cpu load
Ruby 650.83 33,224 1432 2,526.31 99% 99% 94% 98%
Python 3 565.97 15,528 950 2,172.63 95% 94% 95% 100%
k-nucleotide
source secs mem gz cpu cpu load
Ruby 95.75 381,692 858 334.94 80% 82% 97% 95%
Python 3 77.65 182,700 1967 302.86 97% 99% 97% 98%
fasta
source secs mem gz cpu cpu load
Ruby 74.75 107,448 1069 74.60 1% 6% 100% 2%
Python 3 59.47 15,996 1947 138.97 55% 55% 63% 66%
reverse-complement
source secs mem gz cpu cpu load
Ruby 32.71 497,404 264 32.69 100% 1% 1% 0%
Python 3 18.79 1,008,868 814 19.73 9% 69% 35% 30%
mandelbrot
source secs mem gz cpu cpu load
Ruby 518.75 145,668 925 2,069.59 100% 100% 100% 100%
Python 3 225.24 15,736 688 899.25 100% 100% 100% 100%
Ruby

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

Python 3

Python 3.6.3