The Computer Language
22.01 Benchmarks Game

PHP versus Python 3 fastest programs

Always look at the source code. These are only the fastest programs.

If they are manually vectorized SIMD, does the host language matter? You might not be interested in the most optimised programs.

Look at "mandelbrot" or "spectral-norm" or other measurement tables. Look at the other programs. Choose which programs you want to compare.

spectral-norm
source secs mem gz busy cpu load
PHP 7.03 37,884 1152 27.90 99% 99% 99% 99%
Python 3 112.97 48,792 407 450.01 100% 100% 100% 100%
n-body
source secs mem gz busy cpu load
PHP 65.72 12,940 1082 66.13 0% 100% 0% 0%
Python 3 541.34 7,780 1196 544.06 0% 100% 0% 0%
mandelbrot
source secs mem gz busy cpu load
PHP 23.26 142,252 875 92.82 100% 100% 100% 100%
Python 3 177.35 47,780 688 703.41 99% 99% 99% 99%
fannkuch-redux
source secs mem gz busy cpu load
PHP 57.71 46,568 1162 228.98 100% 99% 99% 99%
Python 3 341.45 45,548 950 1,347.78 100% 99% 96% 99%
binary-trees
source secs mem gz busy cpu load
PHP 17.82 1,589,760 760 63.91 89% 89% 96% 84%
Python 3 44.70 273,136 660 161.37 83% 90% 91% 97%
k-nucleotide
source secs mem gz busy cpu load
PHP 19.76 255,072 1079 67.84 96% 76% 96% 76%
Python 3 46.31 246,576 1967 175.36 94% 95% 96% 94%
fasta
source secs mem gz busy cpu load
PHP 20.77 13,076 1062 21.01 1% 0% 0% 100%
Python 3 36.90 836,484 1947 68.94 43% 10% 74% 60%
pidigits
source secs mem gz busy cpu load
PHP 0.92 14,236 399 0.93 0% 100% 1% 0%
Python 3 1.16 11,700 567 1.19 1% 100% 1% 1%
reverse-complement
source secs mem gz busy cpu load
PHP 6.96 536,328 446 11.04 48% 6% 32% 73%
Python 3 6.62 1,005,400 814 10.00 3% 48% 72% 28%
regex-redux
source secs mem gz busy cpu load
PHP 1.83 189,236 816 3.65 36% 35% 88% 41%
Python 3 1.34 111,492 1403 2.62 36% 41% 32% 87%
PHP

PHP 8.1.1 (cli) (built: Jan 6 2022 19:24:43) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies

Python 3

Python 3.10.1