Benchmarking PHP 7.4.7 vs. PHP 8 alpha2
I executed the Zend\bench.php file using PHP 7.4.7 and PHP 8 alpha2.
I used a CPU Intel i9-8950HK at 2.90GHz with 32GB RAM running Ubuntu 18.04.4 LTS.
I compiled PHP 8 alpha2 using the official php.net source and installed in /opt/php/php8
. I used the following configure options:
./configure --prefix=/opt/php/php8 --enable-opcache --with-zlib --enable-zip --enable-json --enable-sockets --without-pear
I used the PHP 7.4.7 version using the ppa:ondrej/php repository.
To run the benchmark I used the command as follows:
PHP 7.4.7
php -d opcache.enable_cli=0 Zend/bench.php
PHP 7.4.7 + opcache
php -d opcache.enable_cli=1 Zend/bench.php
PHP 8 alpha2
/opt/php/php8/bin/php -d opcache.enable_cli=0 Zend/bench.php
PHP 8 alpha2 + opcache
/opt/php/php8/bin/php -d opcache.enable_cli=1 Zend/bench.php
PHP 8 alpha2 + JIT (1235)
/opt/php/php8/bin/php -d opcache.enable_cli=1 -d opcache.jit_buffer_size=128M -d opcache.jit=1235 Zend/bench.php
Results
I run the experiment 5 times for each PHP configuration and I took the average (last row in the table). The time are reported in seconds.
PHP 7.4 | PHP 7.4 + opcache | PHP 8 alpha 2 | PHP 8 alpha2 + opcache | PHP 8 alpha 2 + JIT (1235) |
---|---|---|---|---|
0.315 | 0.191 | 0.283 | 0.196 | 0.089 |
0.316 | 0.190 | 0.289 | 0.191 | 0.104 |
0.315 | 0.221 | 0.284 | 0.194 | 0.093 |
0.323 | 0.185 | 0.28 | 0.202 | 0.089 |
0.317 | 0.193 | 0.303 | 0.190 | 0.091 |
----- | ----- | ----- | ----- | ----- |
0.317 | 0.196 | 0.288 | 0.195 | 0.093 |