The Computer Language
24.12 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 460.00 19,700 447 459.93
PHP #4 128.28 19,700 1168 512.34
PHP #3 129.55 19,700 1166 514.06
Ruby yjit #2 152.41 19,680 1462 591.05
PHP 591.53 19,700 488 591.44
Ruby yjit 1,451.71 19,680 391 1,451.48
PHP #8 1,731.37 19,700 477 1,731.10
Ruby yjit #8 1,932.07 19,680 418 1,931.76
n-body
source secs mem gz cpu secs
Ruby yjit #3 166.55 19,620 1169 166.53
Ruby yjit #2 172.26 19,620 1143 172.23
PHP #3 204.18 19,768 1088 204.15
PHP #8 246.25 19,768 1245 246.21
Ruby yjit #8 317.96 19,620 1160 317.90
Ruby yjit #7 769.49 19,620 1139 769.35
spectral-norm
source secs mem gz cpu secs
PHP 18.14 19,768 1157 72.35
Ruby yjit #4 128.52 22,656 333 128.51
PHP #2 132.92 19,768 403 132.89
PHP #8 136.62 19,768 357 136.59
PHP #3 35.75 19,768 1214 141.74
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 262.49 19,768 452 262.45
PHP #3 71.34 47,676 881 284.83
PHP #8 420.99 19,768 419 420.89
Ruby yjit #5 141.70 79,248 978 565.92
Ruby yjit #4 578.95 126,996 853 579.53
Ruby yjit #2 165.71 87,360 887 660.93
Ruby yjit #8 942.59 19,620 364 942.41
Ruby yjit #3 1,695.20 19,620 313 1,694.90
Ruby yjit #6   Timed Out  
Ruby yjit #7   Timed Out  
fasta
source secs mem gz cpu secs
PHP #3 31.09 19,768 1065 31.08
Ruby yjit #6 34.00 113,008 1097 33.99
Ruby yjit #3 43.54 113,048 1035 43.53
PHP #2 47.15 19,768 1054 47.14
PHP #8 49.44 19,960 760 49.43
Ruby yjit #2 82.85 136,432 747 82.83
Ruby yjit #5 99.25 19,620 1000 99.23
Ruby yjit #4 142.74 294,212 864 142.15
Ruby yjit #8 190.64 19,620 700 190.20
k-nucleotide
source secs mem gz cpu secs
PHP #8 79.41 629,652 571 79.39
PHP #4 25.74 259,940 1290 90.19
Ruby yjit #7 255.31 385,864 792 253.65
Ruby yjit #2 263.04 171,524 426 262.74
Ruby yjit #3 300.38 198,360 546 300.61
Ruby yjit 87.40 162,976 583 318.58
Ruby yjit #8 529.77 599,256 529 529.29
reverse-complement
source secs mem gz cpu secs
PHP 10.22 1,488,780 323 10.22
Ruby yjit #4 6.11 2,491,828 608 11.94
PHP #2 12.21 1,786,608 288 12.20
PHP #3 8.13 536,024 452 12.47
Ruby yjit #5 13.38 1,602,784 301 13.37
Ruby yjit #3 8.36 4,458,064 490 16.48
Ruby yjit #2 19.55 503,176 272 19.54
Ruby yjit 13.21 5,556,616 521 25.63
binary-trees
source secs mem gz cpu secs
Ruby yjit #4 46.97 472,012 371 46.94
Ruby yjit 48.77 471,992 383 48.75
Ruby yjit #2 48.83 471,996 385 48.80
Ruby yjit #3 49.58 507,116 407 49.55
Ruby yjit #5 18.85 473,532 1016 53.80
PHP #3 69.49 920,800 434 69.47
PHP #4 24.86 917,608 786 81.20
PHP #7 22.22 947,804 767 81.25
PHP 90.61 748,120 457 90.59
PHP #2 93.68 748,028 429 93.66
PHP #5 47.37 804,828 1048 125.31
PHP #6 38.24 804,884 877 130.14
Ruby yjit #8 135.03 471,944 494 134.99
PHP #8 146.78 749,804 590 146.75
pidigits
source secs mem gz cpu secs
PHP #5 0.97 19,768 405 0.97
PHP #3 0.99 19,768 510 0.99
PHP #4 0.99 19,768 396 0.99
PHP #2 1.49 19,768 552 1.49
Ruby yjit 18.03 49,168 524 18.03
PHP 102.67 19,768 756 102.65
Ruby yjit #2   Failed  
Ruby yjit #5   Failed  
regex-redux
source secs mem gz cpu secs
PHP 1.87 194,684 822 3.70
Ruby yjit #2 23.47 212,160 444 23.47
Ruby yjit #3 12.36 208,604 730 24.37
Ruby yjit #9 30.70 212,104 340 30.69
Ruby yjit

ruby 3.4.0dev
(2024-12-25
master f450108330)
+YJIT +PRISM [x86_64-linux]

PHP

PHP 8.4.1 (cli)
(built: Nov 22 2024 14:22:47) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.1,
with Zend OPcache v8.4.1,
Copyright (c) Zend Technologies