I’m searching for methods to boost up C#/.NET application.
What I found so far is
- Use ngen.
- Careful when using as operator
- Careful when using reflection API. It takes quite a while to load dll with
Assembly.LoadFrom().
What else tools/tips/good practices do you have to get the best performance out of C#/.NET program.
First be careful with ngen. It might actually end up hurting performance. See Jeff Richter’s book “CLR via C#, Third Edition” for more details.
Personally I will use a profiler when I need to performance tune my application. The one I prefer is Red-Gate Ants, but there are plenty of good ones on the market. However using these can be a bit tricky because they will produce a lot of noise.
Most of the problems I have seen are usually caused by the developer or overall architecture rather than the .Net Framework. For example an Asp.Net web application that requires 30+ calls to the Database just for the home page to load.