
The widest block in a cold flame graph is the autoloader
The same endpoint profiled twice - 65.8 ms and 8.4 ms. What changed in the picture, and how to tell one slow call from ten thousand fast ones.
18 posts
Posts and notes.

The same endpoint profiled twice - 65.8 ms and 8.4 ms. What changed in the picture, and how to tell one slow call from ten thousand fast ones.

One workload, two profiling mechanisms. Instrumentation cost 13% and missed the function that was 55% of the request; sampling cost nothing measurable and found it.

The same function ran at 21.4 ns with no OPcache, 21.6 with OPcache and the optimizer off, and 14.8 with it on. What the passes removed, dumped one at a time.

The same loop ran 23% faster with int parameters, and only with OPcache on. Operand classes pick a handler when the file compiles; proven types pick a different one.

phpdbg showed thirteen instructions and the optimizer showed nine. Both were right. How to read the notation, and which listing is the one that runs.

The same .= statement took 0.269 ms and 218.836 ms in two loops that differ by one assignment. What a zend_string costs, where literals live, and why implode is not the fix.

Plain, backed and virtual property reads compile to one identical FETCH_OBJ_R. What separates them is a function call the opcode does not show, measured at nine times.

One hundred thousand four-field records cost 143.54 bytes each as objects and 397.14 as associative arrays. Where the crossover is, and what one undeclared property costs.

Two hundred thousand objects created and dropped, and zero collections. What puts an object in the root buffer, and why the collector's cost is set by what you keep alive.

memory_get_usage(), memory_get_usage(true) and ps disagree about one process. What each counts, which one memory_limit reads, and why a one-megabyte string costs two.