Quick & Simple optimization tips
Some quick'n'dirty optimization tips:
1. Be aware that your app will typically spend 95% of it's time in 5% of the code. Invest time on optimizing only where it will really matter.
2. Also be aware that the actual 5% of the code which is taking all the time probably isn't where you might guess. Thats what debuggers are for...
3. XML is great for almost everything except performance. If you are using XML as a data structure in your internal loops, you can sometimes gain a x10 or more perf improvement by preloading the data into specialized, indexed data structures such as hashtables or datasets.
4. RegExes can be serious perf drags. Use with care, especially within loops.
These rules alone resulted in an overall 1000% perf improvement in a framework I am currently developing, and it wasn't really that slow to begin with!
Some open questions from my to-do list:
A. When dealing with large numbers of small objects (such as 50K instances of a 50 byte class) what is the impact of using the flyweight design pattern ?
B. Boxing/Unboxing - worth the time/effort of tracking down & eliminating?