Tuesday, March 4, 2008

Performance issue in Dictionary of enum types

Interesting performance issue: if you have a System.Collections.Generic.Dictionary with key type being an Enum type each request to it performs a boxing of the key due to specifics of JIT optimizations. If you use such constructs in performance-critical parts of your code be sure to replace the default IEqualityComparer with a custom one.

No comments: