One of the best parts about being a programmer is that there’s seemingly always a better way to do things. A simple code tweak can drastically improve the execution time of your web application. The faster your application executes the quicker you release precious server resources.
The first step in optimizing your existing PHP-based web application for speed is knowing which portions of your website need to be improved. Do your MySQL queries take too long? Are you using efficient functions? Are you using unnecessary server resources?
In my web applications I use a timer class to benchmark how long queries, functions, and entire pages are taking to complete.
via davidwalsh.name