Friday, March 14, 2008

.Net Performance Pointers

After going this week to the Microsoft performance open house, here are few things to consider:

  • Create performance counters of your own to measure various statistics.
  • Try to avoid using interfaces and virtual methods to supports inlining.
  • If you use a "Contains" method of a collection on structs, be sure to override the "Equals" method, since the default Object.Eqauls method used boxing twice - once for the parameter and the once for "this".
  • Similarly, you should override the GetHashCode methods for structs, since the default implementation for a struct is very inefficient.
  • Use Perfmon.exe to monitor the "% time in GC" - a high value may indicate mid-life crisis.

No comments: