-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PcovDriver causing 2x slowness of coverage run after upgrade to phpunit 9.5 #876
Comments
Not an upstream issue, looks related to other changes in the driver. |
Thank you for looking into this, Joe, and so quickly. |
dvdoug
added a commit
to dvdoug/php-code-coverage
that referenced
this issue
Oct 27, 2021
dvdoug
added a commit
to dvdoug/php-code-coverage
that referenced
this issue
Oct 27, 2021
dvdoug
added a commit
to dvdoug/php-code-coverage
that referenced
this issue
Oct 27, 2021
dvdoug
added a commit
to dvdoug/php-code-coverage
that referenced
this issue
Oct 28, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After switching to phpunit 9.5 a 2x slowness was witnessed (4.5 min => 9min). Previous reports/issues about new AST parser library caused some false assumptions. Testing with static cache did not improve speed much nor did cache warming improve things to the original levels.
After digging through the coverage logic and adding all sorts of time measurements to the coverage collecting steps, the main slownesses seems to come from ProcessedCodeCoverageData->markCodeAsExecutedByTestCase() and ProcessedCodeCoverageData->initializeUnseenData()
The functions themselves are not big and don't do anything obviously slow.
Adding more debug info showed that the list of classes being processed was 500 files with 20 000 lines and this happened for each test execution, even if test actually called only one short function that has 1 line in it.
After more checks it seems that PCOV extension is returning list of all seen files during the whole run, even if 0 code was actually executed since last call to clear(), causing lots of overhead to the functions that then try to analyze the results.
Adding following code to PcovDriver->stop() after \pcov\clear(); to ignore file entries where ALL lines are marked as not executed restores the speed to original levels:
The text was updated successfully, but these errors were encountered: