Sunday, July 13, 2014

C#: Suggestions to improve performance - Boxing & Collections

Below blogpost talks about how to use a Memory Profiler also - dotMemory.

http://blog.jetbrains.com/dotnet/2014/07/10/unusual-ways-of-boosting-up-app-performance-boxing-and-collections/
When you introduce some struct type, make sure that methods that work with this struct don’t convert it to a reference type anywhere in the code. For example, one common mistake is passing variables of value types to methods working with strings (e.g.,String.Format):Fixing boxing A simple fix is to call the ToString() method of the appropriate value type:Fixing boxing 2

No comments:

Post a Comment

Followers

Blog Archive