Skip to content

Instantly share code, notes, and snippets.

@ezimuel
Last active September 17, 2019 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezimuel/a4820143adbae6b05df96f973d42f834 to your computer and use it in GitHub Desktop.
Save ezimuel/a4820143adbae6b05df96f973d42f834 to your computer and use it in GitHub Desktop.
Benchmarking execution times of PHP from 7.1 to 7.4

Benchmarking execution time of PHP from 7.1 to 7.4

In this experiment, I tested the execution time of the script Zend\bench.php available in the PHP socurce code. I tested the latest PHP versions available, as follows:

  • PHP 7.1.32
  • PHP 7.2.22
  • PHP 7.3.9
  • PHP 7.4RC1

I executed the experiment using an Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz, with 32GB RAM, HD SSD running Linux Ubuntu 18.04.3 LTS.

Results

Here the results (in seconds) for each PHP versions:

PHP 7.1.32

$ php Zend/bench.php
simple             0.026
simplecall         0.006
simpleucall        0.018
simpleudcall       0.019
mandel             0.069
mandel2            0.069
ackermann(7)       0.019
ary(50000)         0.005
ary2(50000)        0.003
ary3(2000)         0.041
fibo(30)           0.063
hash1(50000)       0.012
hash2(500)         0.007
heapsort(20000)    0.024
matrix(20)         0.020
nestedloop(12)     0.037
sieve(30)          0.013
strcat(200000)     0.003
------------------------
Total              0.455

PHP 7.2.22

$ php Zend/bench.php
simple             0.020
simplecall         0.006
simpleucall        0.016
simpleudcall       0.016
mandel             0.100
mandel2            0.074
ackermann(7)       0.014
ary(50000)         0.004
ary2(50000)        0.003
ary3(2000)         0.035
fibo(30)           0.050
hash1(50000)       0.008
hash2(500)         0.006
heapsort(20000)    0.020
matrix(20)         0.019
nestedloop(12)     0.032
sieve(30)          0.011
strcat(200000)     0.003
------------------------
Total              0.437

PHP 7.3.9

$ php Zend/bench.php 
simple             0.018
simplecall         0.006
simpleucall        0.012
simpleudcall       0.014
mandel             0.075
mandel2            0.068
ackermann(7)       0.012
ary(50000)         0.004
ary2(50000)        0.003
ary3(2000)         0.029
fibo(30)           0.043
hash1(50000)       0.008
hash2(500)         0.005
heapsort(20000)    0.019
matrix(20)         0.016
nestedloop(12)     0.029
sieve(30)          0.010
strcat(200000)     0.003
------------------------
Total              0.373

PHP 7.4RC1

$ php Zend/bench.php
simple             0.013
simplecall         0.005
simpleucall        0.013
simpleudcall       0.013
mandel             0.053
mandel2            0.061
ackermann(7)       0.012
ary(50000)         0.004
ary2(50000)        0.005
ary3(2000)         0.028
fibo(30)           0.043
hash1(50000)       0.007
hash2(500)         0.005
heapsort(20000)    0.016
matrix(20)         0.016
nestedloop(12)     0.025
sieve(30)          0.010
strcat(200000)     0.003
------------------------
Total              0.334
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment