One of the first rules of optimizing is: let the compiler do it for you.
You are more likely to get mileage from making sure you have an efficient algorithm (such as O(ln(n)) vs O(n^2)) than from trying to do minor tweaks. Also, be aware of WHERE you are getting the most slowdown in your code. If your code runs slow because it does a ton of disk access, optimize there, not in the memory management.
|