symfony / flex

Composer plugin for Symfony
MIT License
4.16k stars 183 forks source link

Set XDEBUG_MODE=off when running cache:clear command via auto-scripts #936

Open Seldaek opened 2 years ago

Seldaek commented 2 years ago

As https://github.com/symfony/flex/issues/743 was rejected (and I can't really argue with the reasoning tbh) - it would be nice to set XDEBUG_MODE=off in the env while running cache:clear, as running a cache warmup with xdebug enabled can have quite a big impact on perf (seeing 60-70% less CPU time here).

Of course everyone can fix this themselves, but doing it here would improve the experience for everyone at once.

I'd argue perhaps the cache:clear command could use something like composer/xdebug-handler even to force itself being run without xdebug, but that's a more invasive change.

hubertnnn commented 1 year ago

I don't know if this is a good solution to everyone. cache:clear is not just clearing cache, it is also running a warmup and validating if your code is correctly written. Not sure how much of this validation needs (if it even takes advantage of) xdebug, but its better for xdebug to be on during debugging than not, including the automatic debugging.

Though having a --dont-debug option would be nice. Its so annoyoing when I am working on service A and when I am trying to test if it works I keep getting interrupted by "serivce B is invalid". I know its invalid, I have not finished it, because I need to finish service A first. Sorry for the rant.

ro0NL commented 1 year ago

we gained 3m on build tests by adding export XDEBUG_MODE=off where needed

thanks! :100:

ro0NL commented 12 months ago

little update, we disabled xdebug by default and enabled it when needed. I think it's the better approach, rather than disabling hardcoded.