1 : Are the PHP programs faster? At a glance.

Each chart bar shows, for one unidentified benchmark, how much the fastest PHP program used compared to the fastest C++ g++ program.

(Memory use is only compared for tasks that require memory to be allocated.)


These are not the only compilers and interpreters. These are not the only programs that could be written. These are not the only tasks that could be solved. These are just 10 tiny examples.

 2 : Are the PHP programs faster? Approximately.

Each table row shows, for one named benchmark, how much the fastest PHP program used compared to the fastest C++ g++ program.

(Memory use is only compared for tasks that require memory to be allocated.)

 PHP used what fraction? used how many times more? 
Benchmark Time Memory Code
 pidigits± 1/2
 k-nucleotide±
 regex-dna±1/2
 reverse-complement1/9
 fasta-redux31× ±
 fasta35× ±
 mandelbrot50× 1/2
 binary-trees50×1/2
 spectral-norm54× 1/3
 n-body85× ±
 fannkuch-redux94× 1/3
 PHP used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)±±35×52×94×94×

± read the measurements and then read the program source code.

 3 : Are the PHP programs faster? Measurements.

These are not the only tasks that could be solved. These are just 10 tiny examples. These are not the only compilers and interpreters. These are not the only programs that could be written.

For each named benchmark, measurements of the fastest PHP program are shown for comparison against measurements of the fastest C++ g++ program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 pidigits 
PHP2.782.783,588394  0% 0% 1% 100%
C++ g++2.682.681,452682  0% 1% 4% 100%
 k-nucleotide 
PHP44.2744.30246,9601036  0% 1% 1% 100%
C++ g++24.0324.04138,9601252  1% 1% 0% 100%
 regex-dna 
PHP26.5026.52219,260459  1% 0% 0% 100%
C++ g++5.335.34170,488695  0% 0% 1% 100%
 reverse-complement 
PHP7.867.88443,500262  0% 0% 0% 100%
C++ g++0.980.99245,6922275  3% 1% 0% 99%
 fasta-redux 
PHP66.7366.752,5881110  1% 0% 0% 100%
C++ g++2.162.176201474  0% 2% 0% 100%
 fasta 
PHP144.06147.412,5841030  0% 0% 0% 100%
C++ g++4.224.228721286  1% 1% 0% 100%
 mandelbrot 
PHP1,161.921,162.373,120443  1% 0% 0% 100%
C++ g++23.4423.4532,1801017  0% 1% 1% 100%
 binary-trees 
PHP543.90544.49546,272472  0% 0% 0% 100%
C++ g++10.9210.94148,508892  1% 1% 0% 100%
 spectral-norm 
PHP425.08425.254,848397  0% 0% 0% 100%
C++ g++7.927.939241044  0% 1% 1% 100%
 n-body 
PHP770.70771.002,5881082  0% 0% 0% 100%
C++ g++9.089.083361544  0% 0% 1% 100%
 fannkuch-redux 
PHP2,558.802,559.742,540441  0% 0% 0% 100%
C++ g++27.2227.232841150  0% 1% 1% 100%

 4 : Are there other PHP programs for these benchmarks?

Remember - those are just the fastest PHP and C++ g++ programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for PHP.

Maybe one of those other PHP programs is fastest on a different OS/machine.

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest PHP and C++ g++ programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 PHP : scripts embedded in html and much more 

PHP 5.5.0 (cli) (built: Jun 25 2013 13:34:35)

Overall Performance: PHP is rarely the bottleneck (HTML slides)

Home Page: http://www.php.net/

Download: http://www.php.net/downloads.php

Revised BSD license

  Home   Conclusions   License   Play