The Computer Language
Benchmarks Game

PHP programs versus Python 3

by benchmark task performance

regex-dna
source secs KB gz cpu cpu load
PHP 2.23 106,284 832 5.09 62% 78% 49% 42%
Python 3 10.14 258,956 478 23.14 48% 77% 64% 41%
spectral-norm
source secs KB gz cpu cpu load
PHP 41.23 17,104 1135 163.58 99% 99% 100% 99%
Python 3 180.01 55,892 437 714.86 99% 100% 99% 100%
n-body
source secs KB gz cpu cpu load
PHP 432.48 7,928 1082 432.36 0% 100% 0% 1%
Python 3 836.27 7,756 1181 836.06 0% 1% 1% 100%
fasta
source secs KB gz cpu cpu load
PHP 59.28 7,936 1030 59.26 1% 0% 1% 100%
Python 3 113.03 7,860 977 112.99 1% 100% 0% 1%
mandelbrot
source secs KB gz cpu cpu load
PHP 134.34 132,880 863 536.04 100% 100% 100% 100%
Python 3 250.62 52,752 686 1,000.26 100% 100% 100% 100%
k-nucleotide
source secs KB gz cpu cpu load
PHP 44.55 135,472 1060 152.16 81% 92% 76% 93%
Python 3 72.35 229,040 1937 268.72 98% 94% 91% 94%
fannkuch-redux
source secs KB gz cpu cpu load
PHP 321.58 29,140 1150 1,280.13 100% 100% 99% 100%
Python 3 501.72 54,708 944 1,967.92 98% 97% 100% 99%
pidigits
source secs KB gz cpu cpu load
PHP 2.19 8,852 394 2.18 100% 1% 0% 2%
Python 3 3.41 9,992 382 3.40 1% 2% 100% 1%
binary-trees
source secs KB gz cpu cpu load
PHP 103.82 ? 1161 ? 85% 88% 92% 75%
Python 3 126.07 831,740 596 474.55 93% 93% 93% 99%
reverse-complement
source secs KB gz cpu cpu load
PHP 4.02 336,164 297 4.01 2% 0% 100% 0%
Python 3 2.93 265,636 800 4.28 80% 46% 21% 2%
PHP

PHP 7.0.6 (cli) (built: May 4 2016 16:00:18) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

Python 3

Python 3.6.0 (default, Feb 5 2017, 10:29:14) [GCC 5.4.0 20160609] on linux
--enable-optimizations
make profile-opt