PHP at Cognate Press
PHP
PHP internals, performance, architecture and production behavior — measurements over assumptions, trade-offs over rules.
Published as ElephantPHP at elephantphp.com, written by Alden Pike — understanding PHP below the abstraction. First issue .
Every issue on PHP
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.
Walking an array with foreach ($rows as &$row) wraps every element in a zend_reference. On a million integers that is 32 MB the loop never gives back.
A zval is sixteen bytes, a value union and a type tag. What that tag says decides whether an assignment copies anything, what a reference costs, and which variable pays.
pm static, dynamic and ondemand, the memory ceiling nothing enforces, and how to size a pool from measurements rather than guesses.
Container compilation moves reflection from request time to build time. What that removes, what it costs, and when it matters.
One structure serves as list, dictionary and set. Packed and hashed layouts, what each costs in memory, and when a conversion happens.
OPcache removes compilation, not execution. The JIT reaches arithmetic-heavy code and little else. Where the remaining time lives.
Microbenchmarks measure exactly what you tell them to, which is rarely what you meant. Method, noise, and the numbers worth reporting.
A request walks from the SAPI to the Zend VM — lexing, compilation to opcodes, the OPcache lookup that skips both, and execution.
The byline
Writes about what happens beneath frameworks and abstractions, from language internals to production behavior. Measurements over assumptions.
What the title covers
- PHP
- Zend VM
- OPcache
- JIT compilation
- PHP-FPM
- Dependency injection
- Profiling
- Benchmarking
The other languages in the imprint: JavaScript · Java · Python · C# · SQL · Go. Each has one title and one byline behind it — the index is at Topics.