News for hackers. Stuff that matters.
Re:How to profile your PHP applications with Xdebug by idoubtit on Saturday May 07, 2022 @03:19PM (#31297650)
In my experience, Xdebug is not suited to the task. It has a big impact on the executed process, so profiling is slow and biased. The results need some extra processing to get interpreted, which is a pain when experimenting with code changes. It's been a long time since I last used Xdebug to profile anything, so maybe the situation is better now.

My preferred tool is php-spx. Once the extension is loaded into PHP, within seconds you get a flamegraph of where time is spent. It's also easy to apply to command-line scripts. And it's versatile enough (with the right settings) to profile long-running or memory heavy scripts. https://github.com/NoiseByNorthwest/php-spx

SPX could be loaded with docker-compose like this article does for Xdebug. But if you already have a PHP environment, the easiest way to install it is to compile it (sudo apt install php-dev && make && cp modules/spx.so /usr/lib/php/....).

Re:How to profile your PHP applications with Xdebug by stefanfisk on Saturday May 07, 2022 @03:24PM (#31297706)
My god that looks like a god send!

I've tried using xdebug for profiling, but as you say it is just not up to the task. Even leaving the extension enabled without any tracing or debug session enabled wreaks havoc on the performance characteristics.

Re:How to profile your PHP applications with Xdebug by icelancer on Sunday May 08, 2022 @02:15AM (#31301771)
Wow. This looks incredible. We're using Xdebug now and while we have no real complaints, this is on another level. Most of our machines are Linux based so we should be good, but we do have Windows hosts too in testing (unfortunate that it doesn't support them).
Re:How to profile your PHP applications with Xdebug by codegeek on Saturday May 07, 2022 @04:29PM (#31298268)
XDebug is good for debugging code in development environments. Not for profiling in production.