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
Tests take 4 times more time since PhpUnit 8 #3745
Comments
Hello @VincentLanglet! Thanks for taking the time to post an issue with timing differences between PHPUnit v7 and v8. I tried to search for the project shown in the images, but I think it is private, right? Question: do you see this 20+ seconds difference when you switch the project back-and-forth between PHPUnit v7 and v8? What changes do you see when running It is impossible to tell from the configuration and console output what the reason for the difference is. If I had to debug something like this in my own projects, a few things immediately catch my eye:
Perhaps @sebastianbergmann has heard about similar changes in runtime from the community. The PHPUnit self-tests are quite extensive and did not show any significant changes in runtime and resource usage between 7 and 8. |
@epdenouden Yes it's a private project for the work. Not sure if I can make a reproductible repository. Yes, I just have to
I do use |
@VincentLanglet Thanks for the clarification! I do know there was a lot going on surrounding code coverage. Unfortunately I know very little about this part of PHPUnit. Some questions that come to mind:
|
I am not aware of any performance degration of the scale you describe. I would not be surprised if this were related to Symfony Bridge or similar extensions that wrap PHPUnit. |
I don't run with code coverage. If I do, it's not wanted.
So the same version of symfony bridge produce a more performant bridge for phpunit 7 than phpunit 8 ? |
That would be a question for the maintainers of the Symfony Bridge. I do not know whether they have different code paths depending on the version of PHPUnit used. |
For information, on |
In my framework-less test suite I see 10% performance degration in phpunit 8 against v7 |
That is significant. I'm busy with on-demand data providers, giving you back some performance. ;-) Will have a look at comparing 7.x and 8.x with xdebug tracing after that, but it will be a while before I get to it. Any suggestions and help welcome of course. 🔮 |
@epdenouden You may want to give @beberlei's Tideways profiler a try while investigating this. |
Ohhhh |
We noticed the performance hit as well (~10 times slower) after upgrade from 7 (with Symfony 4.2) to 8 (Symfony 4.3) - PHP version has not been changed (7.2). But running it with
makes it fast again. |
@bizley thank you for this bit of information! This provides a good starting point for comparison testing. |
@bizley Rereading, you are talking about the |
Yes, it's for PHP itself. I haven't investigated it since the configuration remain the same. But I'm happy to help (just let me know what you need). |
I did a little experiment and run the test from my local env with PHP 7.3 (previous was dockerized with PHP 7.2) and it was slow again. Then I switched off xdebug (2.7.1) - and tests were fast. Looks like xdebug is the reason for this performance drop. I know, it's expected but it was never so huge. |
Stating the obvious here: a performance degradation is only a performance degredation in PHPUnit if the only difference between two test executions is the version of PHPUnit used. You cannot compare "PHPUnit X without Xdebug" with "PHPUnit Y!=X with Xdebug" and conclude that ""PHPUnit Y!=X" is slower. |
Of course you are right! Nevertheless PHPUnit is slower no matter with xdebug or not. Here are my results (tests set the same in all cases, PHP 7.2):
|
@bizley Thank you for those statistics! Obviously Xdebug makes things a lot slower, however I will investigate deeper after the data provider improvements. That will have me cleaning up quite a bit of old stuff. For example, loading the providers can cause annotation data being read twice, instantiating extra reflection objects and whatnot. My eye is drawn to the difference in slowing down: without |
@MichelHartmann, @sebastianfeldmann, and @SenseException have used git-bisect to track down this performance degradation to #3673. Checking the type of values passed to |
Hi there, i have a problem when executing ./vendor/bin/simple-phpunit in a docker testing stage container. Each time i make a build, test are slow cause simple-phpunit dowload phpunit. How can i download it with other command to mantain it in cache? |
Neither simple-phpunit nor Docker are on topic in this repository. |
Hi, I have the same performance problem but with version 8.5.5, even with very simple testing it can take more than 25 seconds. |
I use this command line to run tests.
With this phpunit.xml.dist
With phpunit 7, it takes 8 seconds.
With phpunit 8, it takes 31 seconds.
The text was updated successfully, but these errors were encountered: