PHP Microbenchmarking04 May 2010
I just posted on the Ning code blog about the PHP microbenchmarking framework we released:
I'm pleased to announce the release of ub, a PHP microbenchmarking framework. You can download it from http://github.com/ning/ub.
The goal is to make it as easy as possible to compare the runtime of alternative approaches to the same problem, such as different regular expressions, or different methods for string or array manipulation.
The source distribution contains a README with some documentation and a bunch of sample benchmarks.
For normal use, it is rare that two similar, but different approaches produce appreciable differences in runtime. (Inefficient regexes and bloated call stacks aside.) The payoff from this kind of benchmarking is really on operations that happen hundreds or thousands of times in a request, or are happening on hundreds or thousands of servers. At that point, shaving off small amounts of runtime performance can really make a difference.
I am looking forward to beef up the set of included benchmarks -- contributions are welcome!