Things I did to improve performance on windows 10, while keeping xdebug on.
enabled opcache
disabled xdebug.remote_autostart
added x-debug helper extension
Hint: if you have xdebug extension with remote_autostart 1, you should keep listener in your IDE always ON, even if you don't have any breakpoints, otherwise everything will run extremely slow (see case 6).
Some tests using a small symfony 4.2 project, in dev mode, time is DomContentLoaded taken from Chrome:
- xdebug ON, remote_autostart 0, listener in IDE ON, debug disabled
for chrome extension:
- no cache: 9.5 seconds
- after caches: 580-620ms
- xdebug ON, remote_autostart 0, listener in IDE ON, debug enabled for chrome
extension:
- no cache: 16.35 seconds
- after caches: 950ms-1s
- xdebug ON, remote_autostart 0, listener in IDE OFF, debug disabled for chrome extension:
- no cache: 9.02 seconds
- after caches: 565-650ms
- xdebug ON, remote_autostart 0, listener in IDE OFF, debug enabled for chrome extension:
- no cache: 13.99 seconds
- after caches: 5.54s
- xdebug ON, remote_autostart 1, listener in IDE ON:
- no cache: 14.92 seconds
- after caches: 1.02s
- xdebug ON, remote_autostart 1, listener in IDE OFF:
- no cache: 14.92 seconds
- after caches: 5.69s
- xdebug OFF:
- no cache: 6.66 seconds
- after caches: 483-525ms
I use case 1 usually and when I need to debug I switch to case 2.
Cases 3, 4, 5, 6 are relevant for people who might not be aware of implications of IDE listener and debug cookie.
UPDATE
I tested the same project with Windows Subsystem for Linux (WSL) enabled and got some improvements.
load times when no caches were something like:
- 6.5 seconds with xdebug enabled but listener off
- 9.5 seconds with xdebug enabled and listener ON
- 2.5 seconds!!! with xdebug disabled
overall WSL improved everything, reducing load time by 50%.
PS: for WSL to work properly you will have to disable Windows Defender Real Time protection, otherwise everything will go 2x slower than without WSL. Maybe there are some options to keep Real Time protection on and exclude WSL, but I don't know at this point.