19.2.6 ProfilingThis is NOT the latest copy of this book; click here for the latest version.
An oft-overlooked feature of IDEs is built-in profiling support. Profiling is the technique of studying the execution of your script, and reporting back how much time was spent in each function - this is absolutely crucial if you are trying to squeeze every last drop of performance out of your code. The 80/20 rule states that 80% of your program's execution time will be spent in just 20% of your code - do not spend your time optimising the 80% of your code that takes up just 20% of your execution time, because it is just not worth the effort.
Profiling helps immensely by providing a clear cut list of results: function A took up 60% of execution time, function B took up 2%. If you do not have profiling, you are as likely to try to optimise function B as you are function A, because you just might not realise how much more important function A is to your performance.
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|