Here is a compiled list of things to look at when optimizing performance critical VB .net code.
- Exceptions are slow
- Use sealed methods, i.e. avoid virtual calls
- Avoid Calls to Interface Methods
Here’s another simple optimization tip: Calling a method through a secondary interface is
slower than calling the same method in the main class interface.
- Use Value Types, But Beware of Boxing
- Implement the Dispose/Finalize Pattern:
- Option Compare Binary, strict and explicit
- +=, AndAlso, etc
- Avoid requalification and do property caching
- Minimize the number of loops inside a Try block, and minimize the number of Try blocks inside
a loop. A long loop could amplify the overhead of structured exception handling.
- Use precompiling