The Computer Language
24.11 Benchmarks Game

Ruby yjit versus PHP fastest performance

How the programs are written matters! Always look at the source code.

If the fastest programs are hand-written vector instructions, does the host language matter? You might be more interested in the less optimised programs — more seconds, less gz source code.

fannkuch-redux
source secs mem gz cpu secs
PHP #2 190.06 19,804 447 190.05
PHP #3 56.00 19,804 1166 222.44
PHP #4 56.07 19,804 1168 222.96
PHP 225.15 19,804 488 225.14
Ruby yjit #2 139.05 21,120 1462 521.30
Ruby yjit 1,354.19 20,864 391 1,354.14
PHP #8 1,527.51 19,440 477 1,527.44
Ruby yjit #8 1,980.46 20,736 418 1,980.37
n-body
source secs mem gz cpu secs
PHP #8 65.76 19,712 1245 65.75
PHP #3 66.53 19,804 1088 66.52
Ruby yjit #3 186.79 20,864 1169 186.79
Ruby yjit #2 215.78 20,864 1143 215.77
Ruby yjit #8 388.21 21,376 1160 388.20
Ruby yjit #7 704.57 21,120 1139 704.53
spectral-norm
source secs mem gz cpu secs
PHP 6.87 19,804 1157 27.14
PHP #2 57.15 19,804 403 57.15
PHP #3 16.34 19,804 1214 64.01
PHP #8 86.11 19,724 357 86.09
Ruby yjit #4 128.52 22,656 333 128.51
Ruby yjit #8 168.99 21,120 294 168.99
Ruby yjit #5 57.89 27,264 764 212.15
mandelbrot
source secs mem gz cpu secs
PHP #8 81.58 19,436 419 81.56
PHP 87.00 19,804 452 87.00
PHP #3 23.38 48,256 881 93.15
Ruby yjit #5 150.28 86,144 978 600.37
Ruby yjit #4 652.14 135,516 853 652.89
Ruby yjit #2 254.39 93,952 887 1,016.26
Ruby yjit #8 1,507.03 21,428 364 1,506.75
Ruby yjit #3 1,588.59 20,992 313 1,588.52
Ruby yjit #6   Failed  
Ruby yjit #7   Failed  
fasta
source secs mem gz cpu secs
PHP #3 21.15 19,804 1065 21.14
PHP #2 29.41 19,804 1054 29.41
Ruby yjit #6 31.90 120,832 1097 31.90
Ruby yjit #3 43.90 120,576 1035 43.90
Ruby yjit #5 90.76 23,168 1000 90.75
Ruby yjit #4 95.10 266,624 864 95.09
Ruby yjit #2 106.06 147,176 747 106.05
PHP #8 265.71 27,768 742 265.18
Ruby yjit #8 270.10 27,768 678 269.94
k-nucleotide
source secs mem gz cpu secs
PHP #8 55.69 630,452 571 55.67
PHP #4 21.61 260,560 1290 69.80
Ruby yjit #2 252.78 181,808 426 252.58
Ruby yjit #3 277.67 207,596 546 277.88
Ruby yjit #7 300.36 392,960 792 298.86
Ruby yjit 86.11 171,696 583 302.91
Ruby yjit #8 788.25 572,736 529 787.84
reverse-complement
source secs mem gz cpu secs
PHP 9.89 1,489,328 323 9.89
Ruby yjit #4 5.88 2,510,920 608 11.51
PHP #2 11.75 1,787,280 288 11.75
PHP #3 7.75 536,668 452 12.24
Ruby yjit #5 14.12 1,623,336 301 14.11
Ruby yjit #3 8.95 4,235,052 490 17.34
Ruby yjit #2 27.45 1,001,920 272 27.45
Ruby yjit 18.31 5,141,976 521 35.91
binary-trees
source secs mem gz cpu secs
PHP #3 46.07 921,600 434 46.07
Ruby yjit #4 47.23 478,464 371 47.22
Ruby yjit 48.86 478,592 383 48.85
Ruby yjit #2 48.90 524,800 385 48.89
Ruby yjit #3 49.82 517,080 407 49.81
Ruby yjit #5 19.08 521,972 1016 54.19
PHP #7 15.58 948,608 767 56.00
PHP #4 18.34 918,528 786 56.94
PHP 61.97 748,788 457 61.97
PHP #2 63.25 748,792 429 63.24
PHP #5 33.17 805,512 1048 84.83
PHP #6 27.48 805,532 877 91.38
PHP #8 92.50 750,592 590 92.49
Ruby yjit #8 130.97 478,720 494 130.95
pidigits
source secs mem gz cpu secs
PHP #5 0.96 19,932 405 0.96
PHP #4 0.98 19,804 396 0.98
PHP #3 0.98 19,804 510 0.98
PHP #2 1.47 19,932 552 1.47
Ruby yjit #5 1.50 1,011,072 494 1.50
Ruby yjit #2 3.10 2,431,144 666 3.09
Ruby yjit 17.73 104,576 524 17.72
PHP 335.40 19,804 756 335.39
regex-redux
source secs mem gz cpu secs
PHP 1.85 194,856 822 3.72
Ruby yjit #2 22.86 216,576 444 22.87
Ruby yjit #3 11.84 216,576 730 23.97
Ruby yjit #9 29.92 216,704 340 29.91
Ruby yjit

ruby 3.3.5
(2024-09-03
revision ef084cc8f4)
+YJIT [x86_64-linux]

PHP

PHP 8.3.11 (cli)
(built: Sep 5 2024 12:34:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.11,
with Zend OPcache v8.3.11,
Copyright (c) Zend Technologies