The Computer Language
Benchmarks Game

PHP versus Ruby fastest programs

Always look at the source code.

These are only the fastest programs. Do some of them use manually vectorized SIMD? Look at the other programs. They may seem more-like a fair comparison to you.

spectral-norm
source secs mem gz busy cpu load
PHP 7.51 35,364 1152 29.55 99% 98% 98% 98%
Ruby 118.16 24,764 326 120.08 0% 1% 100% 0%
mandelbrot
source secs mem gz busy cpu load
PHP 24.89 135,480 875 99.12 100% 100% 99% 100%
Ruby 262.79 69,328 880 1,049.78 100% 100% 100% 100%
regex-redux
source secs mem gz busy cpu load
PHP 1.73 162,348 816 3.58 37% 88% 44% 39%
Ruby 9.66 277,900 724 21.43 44% 96% 38% 43%
k-nucleotide
source secs mem gz busy cpu load
PHP 20.15 254,792 1079 69.22 91% 96% 80% 76%
Ruby 77.22 146,188 576 271.55 81% 84% 93% 93%
fannkuch-redux
source secs mem gz busy cpu load
PHP 63.18 44,168 1160 250.98 99% 99% 100% 99%
Ruby 181.72 26,276 1455 716.75 99% 100% 99% 96%
n-body
source secs mem gz busy cpu load
PHP 71.75 12,072 1082 76.86 3% 1% 2% 100%
Ruby 188.10 23,088 1163 191.79 0% 1% 1% 100%
pidigits
source secs mem gz busy cpu load
PHP 0.91 13,196 399 0.96 2% 0% 3% 100%
Ruby 2.11 541,320 485 4.16 53% 6% 100% 39%
reverse-complement
source secs mem gz busy cpu load
PHP 7.06 534,336 446 11.90 14% 49% 40% 65%
Ruby 11.45 2,009,880 482 21.50 34% 70% 57% 26%
binary-trees
source secs mem gz busy cpu load
PHP 18.64 1,588,704 760 67.29 89% 90% 96% 86%
Ruby 23.80 566,560 1008 67.07 58% 96% 63% 64%
fasta
source secs mem gz busy cpu load
PHP 22.82 12,356 1062 24.32 3% 2% 2% 100%
Ruby 25.63 120,804 1069 28.41 0% 10% 100% 1%
PHP

PHP 8.0.0 (cli) (built: Nov 26 2020 09:02:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies

Ruby

ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
--jit