First off, code-readability goes out the window for this question. I’m all for code readability but speed comes first here.
When your code absolutely, without a doubt, no exceptions has to run as fast as possible in the .Net framework, what are some optimizations that can be done? I know there are flags for the compiler to optimize it and I’ve certainly seen improvements thanks to them… but what if that’s not good enough? What are some tried and true techniques for scraping down to the fewest clock cycles necessary to get a process done?
Turn off exceptions (i.e. dont use them)
Turn off bound checking
Use a profiler to find bottlenecks
edit:
Also read this article written by myself, http://www.sumyan.nl/2010/06/08/multidimensional-array-performance/ It is a very specific optimization, also platform dependent but very little known and very useful.