Performance debugging in PHP requires three complementary disciplines: tracing, profiling, and benchmarking. Tracing records every function call to reveal execution flow, best visualized as flamegraphs or flamecharts using Xdebug and Inferno. Profiling aggregates execution data to identify where time is spent, using metrics like self time and inclusive time, with tools like Xdebug (cachegrind format), QCacheGrind, gprof2dot, and PHP-SPX. Benchmarking provides controlled, repeatable measurements to confirm whether a fix actually improved performance, using tools like Hyperfine and PHPBench. The three disciplines form a coherent workflow: trace to narrow the search, profile to confirm and quantify the bottleneck, then benchmark to validate the fix and detect future regressions.
Table of contents
Tracing: what happenedProfiling: what cost the mostBenchmarking: proving itA coherent workflowSort: