Skip to: Site menu | Main content

PHP Performance Profiling

Thu, Jul 1st 2004: Melbourne, Australia: phpMelb

Due to the incredible growth of PHP in the last couple of years it's now being used for tasks ranging from tiny scripts to large-scale Web applications. Some Web applications contain hundreds of thousands of lines of PHP code. Of course bigger and more complex projects result in more load on your servers, and when you throw a database into the mix you have even more potential performance bottlenecks to track. But how do you find the bottlenecks in the first place?

The answer is a technique known as performance profiling.

Performance profiling runs your code in a controlled environment and returns a report listing such statistics as time spent within each function, how long each database query takes and how much memory has been used.

By doing performance profiling on your code, you quickly can see where you may be wasting time with slow database queries or inefficient code.