The Computer Language
Benchmarks Game

PHP versus Python 3 fastest programs

Always look at the source code.

These are only the fastest programs. Do some of them use manually vectorized SIMD? Look at the other programs. They may seem more-like a fair comparison to you.

spectral-norm
source secs mem gz busy cpu load
PHP 7.51 35,364 1152 29.55 99% 98% 98% 98%
Python 3 120.99 13,424 407 479.86 99% 99% 99% 99%
n-body
source secs mem gz busy cpu load
PHP 71.75 12,072 1082 76.86 3% 1% 2% 100%
Python 3 567.56 8,076 1196 570.95 0% 0% 0% 100%
mandelbrot
source secs mem gz busy cpu load
PHP 24.89 135,480 875 99.12 100% 100% 99% 100%
Python 3 163.32 12,080 688 642.00 98% 98% 98% 98%
fannkuch-redux
source secs mem gz busy cpu load
PHP 63.18 44,168 1160 250.98 99% 99% 100% 99%
Python 3 352.29 12,232 950 1,392.10 97% 99% 100% 99%
binary-trees
source secs mem gz busy cpu load
PHP 18.64 1,588,704 760 67.29 89% 90% 96% 86%
Python 3 48.03 462,732 472 174.44 89% 97% 88% 89%
k-nucleotide
source secs mem gz busy cpu load
PHP 20.15 254,792 1079 69.22 91% 96% 80% 76%
Python 3 46.28 241,108 1967 176.42 94% 97% 95% 96%
fasta
source secs mem gz busy cpu load
PHP 22.82 12,356 1062 24.32 3% 2% 2% 100%
Python 3 37.32 846,264 1947 71.03 10% 67% 83% 30%
pidigits
source secs mem gz busy cpu load
PHP 0.91 13,196 399 0.96 2% 0% 3% 100%
Python 3 1.28 12,024 567 1.29 0% 1% 100% 0%
reverse-complement
source secs mem gz busy cpu load
PHP 7.06 534,336 446 11.90 14% 49% 40% 65%
Python 3 7.20 1,005,184 814 10.75 20% 53% 48% 29%
regex-redux
source secs mem gz busy cpu load
PHP 1.73 162,348 816 3.58 37% 88% 44% 39%
Python 3 1.36 111,852 1403 2.64 32% 40% 33% 88%
PHP

PHP 8.0.0 (cli) (built: Nov 26 2020 09:02:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies

Python 3

Python 3.9.2