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).
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/....).