Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is well-known that Xdebug requires a lot of resources in order to do it's work and running a test suite under Xdebug to generate code coverage data is therefore a lot slower than running it without.
For this reason, PHPUnit has the ability for a user to generate an Xdebug filter script which can be used on subsequent executions to significantly speed up coverage by telling Xdebug to ignore code not in the whitelist e.g. in
vendor
. Since it requires manual setup work from them and is not "out of the box", most users do not do this.Since the filter script must be executed before the other files are executed, it is not possible to have a fully automatic version of this. However it is possible to get something fairly close, perhaps 95% as efficient by automatic means.
When the Xdebug driver class is constructed, it receives the whitelist filter configuration. By initiating the built in Xdebug filter at this time, part of PHPUnit is already loaded, part of php-code-coverage is already loaded and it's too late for Xdebug to be able to exclude them. However, the rest of PHPUnit, the rest of php-code-coverage, the other phpunit/* codebases (notably php-token-stream), the rest of
vendor
and the contents oftest
can all be excluded i.e. actually most things.This is essential for path coverage (#380) as the Xdebug memory requirements are otherwise very very large. It also allows most users (those not using a prepend script) to get a significant speed boost even when using standard line-based coverage.
Those who do use a prepend script can continue to do so to obtain absolute maximum performance, since the whitelist of their filter script and the whitelist set here at runtime will the same list this will not undo anything for them.
A similar, but much smaller gain can also be had for PCOV - the PCOV driver currently outputs coverage data for all files which are then filtered later by php-code-coverage. Since we have the list of files we're interested in, we can have the output filtering done inside the PCOV extension itself.