PHPUnit code coverage benchmark
+
Par Remi le lundi 9 novembre 2015, 08:33 - Développement - Lien permanent
As already said numerous time, PHP 7 is faster than PHP 5.
Since PHPUnit 4.8 you can choose between XDebug and phpdbg as driver to retrieve code coverage data, see PHPUnit 4.8: Code Coverage Support.
Here is some benchmark results.
All the tests are run using PHPUnit 5.0.8, PHP 5.6.15 as SCL or PHP 7.0.0RC6 as SCL and XDebug 2.4.0beta1 (freshly released, with some additional patches) for the composer test suite.
PHP 5 without code coverage
$ php56 vendor/bin/phpunit -v Runtime: PHP 5.6.15 Time: 4.78 seconds, Memory: 40.25Mb
PHP 7 without code coverage
$ php70 vendor/bin/phpunit -v Runtime: PHP 7.0.0RC6 Time: 3.37 seconds, Memory: 22.00Mb
So, PHP 7 is faster, gain 30% of time and 45% of memory.
PHP 5 with code coverage
$ php56 vendor/bin/phpunit -v Runtime: PHP 5.6.15 with Xdebug 2.4.0beta1 Time: 1.89 minutes, Memory: 90.50Mb
PHP 7 with code coverage using XDebug
$ php70 vendor/bin/phpunit -v Runtime: PHP 7.0.0RC6 with Xdebug 2.4.0beta1 Time: 39.41 seconds, Memory: 52.00Mb
Again PHP 7 is really faster (65% of time, 43% of memory)
PHP 7 with code coverage using phpdbg
$ php70-phpdbg -qrr vendor/bin/phpunit -v Runtime: PHPDBG 7.0.0RC6 Time: 13.07 seconds, Memory: 92.00Mb
Terribly faster :) 66% of time saved compared to Xdebug, and 89% compared to PHP 5
I notice a lot of developers are not aware of the latest solution, what a pity! I hope this will encourage you to test it.