On June 15th I gave this 1-hour webinar about C# Performance Optimization. The webinar was hosted by Postsharp, creators of the great pattern-aware Visual Studio extension of the same name.
In the webinar, I demonstrate several performance optimization tricks for C# code. I show the overhead of throwing exceptions, the difference between a string and a StringBuilder, I compare array types, I look at for- and foreach-loops, and I’ll show you fast class factory and reflection code.
I use a bunch of neat tricks in my code, including pointer operations that write directly to heap memory, and a custom dynamic method that I build out of individual CIL instructions. At several points in the webinar, I’ll show you the CIL code produced by the C# compiler and point out specific code fragments that improve or impair performance.
If you’d like a copy of the source code I am using in the webinar, just send me an email.
Also published on Medium.