-
-
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
Speed improvements when using xdebug #384
Conversation
MajorCaiger
commented
Sep 23, 2015
- Init data by running xdebug with 'unused' and 'dead code' flags on all whitelist files
- Run xdebug without flags for each test method
- Cache num lines check for each file, to prevent superflous checks
- Init data by running xdebug with 'unused' and 'dead code' flags on all whitelist files - Run xdebug without flags for each test method - Cache num lines check for each file, to prevent superflous checks
Thank you for your contribution. Do you have some performance number you can share? |
Hi all. This is my first time contributing to this project. These changes are due to the following. During the execution of each test, xdebug is run with 'unused' and 'dead code' flags on, which mean each file that is touched as a part of that test execution (including vendor classes, phpunit class, mockery class and other classes outside of the whitelist) get parsed by xdebug which slows everything down. These changes ensure that only whitelisted files are run through xdebug with those flags on, then for each test xdebug runs without flags to determine the actual executed lines. Here is a snippet of the phpunit output on a project that I am currently working on
Here is a snippet of the output after the changes
As you can see there is a massive speed boost with these changes. |
My concerns with this pull request are that
I would be grateful of any suggestions that would allow this concept to be applied? |
I am definitely interested in these changes, especially since the numbers you provided in #384 (comment) look very promising. However, even without the changes to the driver interface this patch would be outside the scope of a bugfix release for the |
Understood. |
No worries, I am reviewing your patch right now and may be able to cherry-pick it into |
Overall, the patch looks good to me. However, I am not (yet) comfortable with the unconditional There must be a way to prevent the inclusion of uncovered files for legacy code that contains files that not only declare classes, interfaces, traits, or functions but also contain executable code in their global scope. An alternative could be to suggest not adding such problematic files to the whitelist. What do you think? |
I seem to remember that without the |
Do your changes also work in case no whitelist is used? |
Good question. Probably not. I will do a little testing over the next few days and let you know my findings. |
Before your patch, PHPUnit's |
On the https://github.com/sebastianbergmann/php-code-coverage/tree/speedup you can find my "cleaned up" version of your changes so far. Please use this as the basis for further work. Thanks! |
OK Thanks. I'll take a look and get back to you. |
Are you able to give me access to the speedup branch so that I can push my changes directly to it? Or shall I submit another merge request? There were a few issues around lines that should be ignored but were being shown as uncovered which I have fixed. This actually increased speed and reduced memory usage a little more to. I have had to removed references to processUncoveredFilesFromWhitelist on a branch of phpunit which I can also submit if it is useful? |
You should be able to push now. |