To optimize your php code you need to know how does each section of you application perform, this library will give you away to measure your code performance.
include 'benchmark.php';
benchmark_start('all');
benchmark_start('parse');
// Do parsing
echo benchmark_end('parse');
benchmark_start('data_fetch');
// Do parsing
echo benchmark_end('data_fetch');
echo benchmark_end('all');



[...] The text is done by fetching the result of a complex query 1000 times, and calculated the time it took using my bechmark library, times in seconds: [...]
Rayed’s Real Life » Blog Archive » Caching: memcached vs MySQL
31 Mar 06 at 12:08 am