The Computer Language
Benchmarks Game

PHP versus Python 3 fastest programs

Always look at the source code.

These are only the fastest programs. 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 118.40 22,912 407 470.86 99% 99% 99% 100%
n-body
source secs mem gz busy cpu load
PHP 71.75 12,072 1082 76.86 3% 1% 2% 100%
Python 3 586.17 8,012 1196 589.84 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 172.58 12,216 688 689.62 100% 100% 100% 100%
fannkuch-redux
source secs mem gz busy cpu load
PHP 63.18 44,168 1160 250.98 99% 99% 100% 99%
Python 3 367.49 12,288 950 1,454.68 100% 98% 99% 98%
binary-trees
source secs mem gz busy cpu load
PHP 18.64 1,588,704 760 67.29 89% 90% 96% 86%
Python 3 49.35 278,628 589 174.26 95% 86% 86% 86%
k-nucleotide
source secs mem gz busy cpu load
PHP 20.15 254,792 1079 69.22 91% 96% 80% 76%
Python 3 46.37 239,472 1967 176.69 94% 95% 98% 94%
fasta
source secs mem gz busy cpu load
PHP 22.82 12,356 1062 24.32 3% 2% 2% 100%
Python 3 39.10 846,628 1947 70.52 43% 8% 61% 69%
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,336 567 1.30 1% 0% 1% 100%
reverse-complement
source secs mem gz busy cpu load
PHP 7.06 534,336 446 11.90 14% 49% 40% 65%
Python 3 7.16 1,005,968 814 10.65 20% 53% 47% 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 112,052 1403 2.64 40% 88% 32% 33%
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.0