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.