The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Perl versus PHP

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
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
Perl #3 5,064 427 1,267.96
Perl #2 12,308 570 1,626.37
Perl 5,288 457 1,731.08
n-body
source mem gz cpu
PHP #3 12,372 1082 66.39
Perl #2 6,280 1429 492.03
spectral-norm
source mem gz cpu
PHP 35,208 1152 27.96
PHP #2 13,444 397 55.81
PHP #3 40,068 1210 60.02
Perl #4 12,044 555 92.70
Perl #5 7,732 340 99.89
Perl 7,708 333 105.24
Perl #2 7,040 343 484.05
Perl #3 18,328 850 498.71
mandelbrot
source mem gz cpu
PHP 12,664 449 86.95
PHP #3 140,544 875 92.75
Perl 62,064 586 1,883.51
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
PHP #2 14,172 545 1.46
Perl #4 8,356 261 1.84
Perl #2 8,368 389 1.96
Perl 12,616 463 9.93
PHP 14,912 750 329.76
regex-redux
source mem gz cpu
PHP 178,712 816 3.66
Perl 205,584 464 21.87
Perl #2 204,960 710 28.74
Perl #3 157,276 854 29.80
Perl #4 157,228 820 29.95
Perl #5   Bad Output  
fasta
source mem gz cpu
PHP #3 12,448 1062 20.99
PHP #2 12,696 1050 28.67
Perl 55,124 871 62.41
Perl #4 6,336 966 129.28
Perl #2 6,224 922 198.31
k-nucleotide
source mem gz cpu
PHP #4 257,260 1079 69.91
Perl #2 659,704 359 131.83
Perl 1,253,716 652 146.30
Perl #4 1,069,344 476 150.18
Perl #3 1,147,148 513 184.94
reverse-complement
source mem gz cpu
Perl #3 1,495,156 287 6.47
PHP 1,487,780 318 9.64
PHP #3 528,172 446 11.26
PHP #2 1,784,488 281 11.31
binary-trees
source mem gz cpu
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
Perl #5 1,048,472 797 209.51
Perl 599,520 395 252.39
Perl #4 2,519,768 761 274.10
Perl #3 2,200,608 648 390.15
Perl

This is perl 5, version 34
subversion 0 (v5.34.0)
x86_64-linux-thread-multi

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