In most web applications, CPU time is spend on mysql, not on script. So exactly know, what takes CPU, need to look mysql processes. With out that, everything is trail and error, not easy to measure actual changes.