Skip to content

Instantly share code, notes, and snippets.

@amenk
Last active January 14, 2020 08:05
Show Gist options
  • Save amenk/29636622c60a420330a8b827d166f9cf to your computer and use it in GitHub Desktop.
Save amenk/29636622c60a420330a8b827d166f9cf to your computer and use it in GitHub Desktop.
XDebug Performance Problem with Magento 2.3

Setup

PHP 7.1 Magento 2.3.2-p2

bin/magento:

global $mageStart;
$mageStart = microtime(true);

\Firebear\ImportExport\Model\Import\Product::saveProducts

global $mageStart;
echo "Time until saveProducts " . (microtime(true) - $mageStart) . PHP_EOL;

(No breakpoints set before that point)

20-xdebug.ini

zend_extension=xdebug.so

xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_autostart=0
xdebug.remote_host=127.0.0.1
xdebug.collect_params=0
xdebug.max_nesting_level=500
xdebug.file_link_format="javascript:var rq = new XMLHttpRequest(); rq.open(\"GET\", \"//localhost:8091?message=%f:%l\", true); rq.send(null);"
xdebug.var_display_max_depth=5

Rough performance comparision

Run without Xdebug

Time until saveProducts 2.23s

Run with Xdebug 2.9.0

Time until saveProducts 228.93s

Run with Xdebug 2.7.2+2.5.5+2.8.0~beta2-1+ubuntu16.04.1+deb.sury.org+11

Time until saveProducts 43.68s

@derickr
Copy link

derickr commented Jan 13, 2020

As a curiosity, how many breakpoints do you have configured?

@amenk
Copy link
Author

amenk commented Jan 13, 2020

If you're not using code coverage, set xdebug.coverage_enable=0

Also 47 secounds on 2.7.2

As a curiosity, how many breakpoints do you have configured?

Only 30 .. I don't clean them often

@amenk
Copy link
Author

amenk commented Jan 13, 2020

But 2.9.1-dev with all but one breakpoints cleared needs only 29s now (in contrast to 2.7.2 which did not become faster)

xdebug.coverage_enable=0 does not have too much of an effect.

@amenk
Copy link
Author

amenk commented Jan 14, 2020

@derickr on my main computer (where I did the performance stats in the first original post), I have 73 break points ...if I delete them I go down to 19s from 49s on 2.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment