Skip to content

Instantly share code, notes, and snippets.

@ezimuel
Created September 23, 2020 11:50
Show Gist options
  • Save ezimuel/bf44d60fd52949701271bfbe46d6ab9c to your computer and use it in GitHub Desktop.
Save ezimuel/bf44d60fd52949701271bfbe46d6ab9c to your computer and use it in GitHub Desktop.
Benchmarking PHP 7.4.10 vs. PHP 8.0.0 beta4

Benchmarking PHP 7.4.10 vs. PHP 8.0.0 beta4

I executed the Zend\bench.php file using PHP 7.4.10 and PHP 8 beta4.

I used a CPU Intel i9-8950HK at 2.90GHz with 32GB RAM running Ubuntu 18.04.4 LTS.

I compiled PHP 8 beta4 using the official php.net source and installed in /opt/php/php8. I used the following options:

./configure --prefix=/opt/php/php8 --enable-opcache --with-zlib --enable-zip --enable-json --enable-sockets --without-pear

I used the PHP 7.4.10 version using the ppa:ondrej/php repository.

To run the benchmark I used the command as follows:

PHP 7.4.10

php -d opcache.enable_cli=0 Zend/bench.php

PHP 7.4.10 + opcache

php -d opcache.enable_cli=1 Zend/bench.php

PHP 8 beta4

/opt/php/php8/bin/php -d opcache.enable_cli=0 Zend/bench.php

PHP 8 beta4 + opcache

/opt/php/php8/bin/php -d opcache.enable_cli=1 Zend/bench.php

PHP 8 beta4 + opcache + 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.10 PHP 7.4.10 + opcache PHP 8 beta4 PHP 8 beta4 + opcache PHP 8 beta4 + opcache + JIT (1235)
0.338 0.214 0.312 0.223 0.103
0.336 0.206 0.308 0.218 0.102
0.329 0.197 0.313 0.213 0.100
0.330 0.219 0.306 0.225 0.104
0.337 0.216 0.306 0.207 0.102
----- ----- ----- ----- -----
0.334 0.210 0.309 0.217 0.102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment