The Computer Language
Benchmarks Game

Ruby versus Python 3 fastest programs

Always look at the source code.

These are only the fastest programs. Look at the other programs. They may seem more-like a fair comparison to you.

n-body
source secs mem gz busy cpu load
Ruby 253.50 25,232 1137 258.38 1% 1% 0% 100%
Python 3 586.17 8,012 1196 589.84 0% 0% 0% 100%
fasta
source secs mem gz busy cpu load
Ruby 31.29 122,852 1069 34.96 2% 4% 5% 100%
Python 3 39.10 846,628 1947 70.52 43% 8% 61% 69%
spectral-norm
source secs mem gz busy cpu load
Ruby 113.92 25,196 326 115.91 1% 0% 1% 100%
Python 3 118.40 22,912 407 470.86 99% 99% 99% 100%
binary-trees
source secs mem gz busy cpu load
Ruby 60.99 875,584 364 63.56 96% 4% 3% 1%
Python 3 49.35 278,628 589 174.26 95% 86% 86% 86%
reverse-complement
source secs mem gz busy cpu load
Ruby 10.58 2,009,736 517 20.20 50% 13% 96% 32%
Python 3 7.16 1,005,968 814 10.65 20% 53% 47% 29%
mandelbrot
source secs mem gz busy cpu load
Ruby 259.25 72,264 931 1,014.80 97% 97% 100% 97%
Python 3 172.58 12,216 688 689.62 100% 100% 100% 100%
k-nucleotide
source secs mem gz busy cpu load
Ruby 72.19 400,272 859 265.83 100% 88% 95% 86%
Python 3 46.37 239,472 1967 176.69 94% 95% 98% 94%
pidigits
source secs mem gz busy cpu load
Ruby 2.01 437,692 485 4.06 49% 10% 100% 42%
Python 3 1.28 12,336 567 1.30 1% 0% 1% 100%
fannkuch-redux
source secs mem gz busy cpu load
Ruby 1,255.50 25,200 384 1,263.51 100% 0% 0% 0%
Python 3 367.49 12,288 950 1,454.68 100% 98% 99% 98%
regex-redux
source secs mem gz busy cpu load
Ruby 9.72 332,016 724 21.17 39% 94% 45% 39%
Python 3 1.36 112,052 1403 2.64 40% 88% 32% 33%
Ruby

ruby 3.0.0preview1 (2020-09-25 master 0096d2b895) [x86_64-linux]
--jit

Python 3

Python 3.9.0