Tierra Innovation

Tierra Lab

Continuous PHP Profiling

Donald Knuth, the demi-god of computer science, famously once said “We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.” Though often quoted it is easy to misunderstand what Knuth was saying – its not that you should ignore performance until the project is complete, tacking on an “optimize code” task at the end, rather it’s that your design should not be complicated by performance considerations from the start.

Continuous profiling is opposite of premature optimization. If done right continuous profiling is like the gauges on a car dashboard. The information is always there and every few moments you glance down to see how you are doing and if any big red lights have come on. Instead of speed, oil temperature and engine RPM you have execution time, memory used and query times.

Here at Tierra we use a range of continuous profiling. Our internal CMS framework offers a rich set of data tacked to the bottom of the page. By default it is enabled in our individual and group development deployments and disabled on our preview and production servers. The profiling info includes the files included, the individual queries run and their execution time and as a byproduct of the framework architecture the duration of pluggable calls in the CMS. The profiling data was modeled on what Konaha’s profiler displays. For our Wordpress work we also have query profiling plugin for Wordpress that we use to gauge the “query weight” of each plugin.

So what if you don’t want to role your own? PQP, the “PHP Quick Profiler”, a recently introduced library from the folks behind wufoo.com is all you’ll need. Its multiple tab interface and BIG text at the top really does look like a car dashboard. All they forgot was the “Check Application” light.

Bookmark and Share


Leave a Reply

Copyright © 2010 Tierra Innovation, Inc.