Rock Your Code Code and App Performance for Microsoft .Net
summary
Benchmarks on .NET 6/7 (3,400+ tests) show concrete speed wins: a retail service ran 20k–50k TPS with an 80 ms SLA so every microsecond matters. Specific fixes: remove unused usings and references, avoid setting default values explicitly, use ToUpperInvariant/ToLowerInvariant for comparisons, prefer StringBuilder for many concatenations, pre-size collections and use Length for arrays, cache compiled Regex in a static field (6–9k ns drops to <500 ns), override Equals for structs, and use System.Text.Json instead of Newtonsoft for faster serialization.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 2:42Code performance matters
- 8:59Cleaner code performance tips
- 13:22String comparisons best practices
- 17:03StringBuilder vs concatenation
- 18:28Optimizing regex in .NET
- 22:05Reference vs structure tips
- 25:42Collections performance
- 27:51Looping collections efficiently
- 30:39Array length vs count
- 31:45Fast collection creation
- 33:12LINQ vs Lambda performance
- 34:16JSON serialization in .NET Core
- 35:18Minor tips & Q&A preview
- 36:26Resources & closing
related talks
01h 00mRock Your Code: Code & App Performance for Microsoft .NET
46mHigh Performance .NET
47mUnlocking Performance Improvements in .NET
01h 03mTurbocharged: Writing High-Performance C# and .NET Code
01h 04mTurbocharged: Writing High-Performance C# and .NET Code
01h 06mGet Better App Performance with this One Weird Trick
12mWhen each millisecond counts?
57mPragmatic Performance: When to care about perf, and what to do about it
