Description
Ning's "Your Own Social Network" application is 160,000 lines of PHP that powers hundreds of thousands social networks, each different than the others. To keep our platform humming along smoothly, as well as to keep our internal development processes sane, we need to know what all that PHP code is doing and how it's structured.
Documentation is nice (and essential) but there's no substitute for relying on the code itself as the canonical source for information about, well, the code. That's where static and dynamic analysis come in.
Static analysis is scanning, parsing, munching, and otherwise processing our PHP source code to answer whatever questions we have about it. Who calls this function? What parts of the code do disk write operations? Are there any untranslated strings in our localization message catalogs?
Dynamic analysis gathers information from running code. How many times is a function called? How long does it take? When does our PHP code access the filesystem?
This talk discusses the static and dynamic analysis techniques that we use at Ning to understand and optimize our platform, including the PHP tokenizer, regular expressions, the vld and xdebug extensions, and the PHP DTrace provider.