Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find why phpunit testsuite is too slow with xdebug?

At phpMyAdmin we suffer strange testsuite slowdown for some time. We've been able to trace the problems down to situation when xdebug is enabled (for code coverage) and there is an error inside ob_start/ob_end_clean block. Removing either of these does drastically reduce testsuite time.

                xdebug       enabled      disabled
ob_start failure tests
enabled                       20 min        15 s
disabled                      1 min         15 s

This is just to show how huge the difference is and why we would like to get rid of that.

At smaller scale, this can be shown with single test test/classes/PMA_Advisor_test.php:

                xdebug       enabled      disabled
ob_start failure tests
enabled                       7.2 s         0.1 s
disabled                      2.6 s         0.1 s

Here the difference is removing of single dataset for one test (in case you would be looking into the sources, it's the last data set) and causes test to take less than half of the time! UPDATE: At this particular case the problem can be mitigated using xdebug.default_enable=0, but that does not change much for whole testsuite.

At first glance it indeed looks like some bug in xdebug, but we have been unable to produce smaller testcase than above, what sounds suspicious. Any ideas how to debug the issue further of how to figure out what is actually causing this slow down?

like image 347
Michal Čihař Avatar asked Nov 13 '22 02:11

Michal Čihař


1 Answers

I've had this problem due to the profiler being on, which will also be generating huge cachegrind files.

Check that xdebug.profiler_enable = 0

> documentation

like image 198
scipilot Avatar answered Nov 23 '22 23:11

scipilot