The Computer Language
22.05 Benchmarks Game

Fastest cpu secs PHP versus Node js

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 cpu seconds, less gz source code.

fannkuch-redux
source mem gz cpu
Node js #5 85,336 1313 44.58
PHP #2 12,612 441 190.33
PHP #3 12,624 1160 230.54
PHP #4 47,808 1162 232.59
PHP 12,764 482 237.28
n-body
source mem gz cpu
Node js #6 41,056 1268 8.43
PHP #3 12,372 1082 66.39
spectral-norm
source mem gz cpu
Node js #7 41,524 414 5.38
Node js 41,668 319 5.45
Node js #6 90,932 999 6.20
PHP 35,208 1152 27.96
PHP #2 13,444 397 55.81
PHP #3 40,068 1210 60.02
mandelbrot
source mem gz cpu
Node js #3 118,180 1122 16.00
Node js #2 48,484 416 28.21
Node js 43,580 373 65.26
PHP 12,664 449 86.95
PHP #3 140,544 875 92.75
pidigits
source mem gz cpu
PHP #5 13,728 399 0.92
PHP #4 13,656 389 0.93
PHP #3 13,804 504 0.95
Node js #4 45,096 481 1.14
PHP #2 14,172 545 1.46
Node js #2 72,556 397 13.11
Node js #3 72,536 424 13.22
PHP 14,912 750 329.76
regex-redux
source mem gz cpu
PHP 178,712 816 3.66
Node js #3 1,045,556 668 5.97
Node js #4 985,940 463 6.24
fasta
source mem gz cpu
Node js #5 101,844 2047 6.38
PHP #3 12,448 1062 20.99
PHP #2 12,696 1050 28.67
Node js 50,304 809 37.60
k-nucleotide
source mem gz cpu
Node js #3 419,748 1812 43.70
PHP #4 257,260 1079 69.91
Node js #2 72,156 935 112.88
Node js 621,752 1008 115.69
reverse-complement
source mem gz cpu
Node js #7 1,556,168 1480 4.97
PHP 1,487,780 318 9.64
PHP #3 528,172 446 11.26
PHP #2 1,784,488 281 11.31
Node js #2 727,572 1221 16.87
binary-trees
source mem gz cpu
Node js #6 1,322,340 744 27.83
Node js 1,173,028 711 36.72
Node js #7 1,107,220 451 40.72
PHP #3 1,561,956 428 51.64
PHP #2 748,408 423 62.27
PHP 748,424 451 62.40
PHP #4 1,558,972 779 62.76
PHP #7 1,589,184 760 64.15
PHP #5 803,212 1040 85.70
PHP #6 802,924 868 90.44
PHP

PHP 8.1.5 (cli)
(built: May 5 2022 10:44:00) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.5,
Copyright (c) Zend Technologies

Node js

v18.1.0