Pragmatic Performance: When to care about perf, and what to do about it
summary
Argues that measurement, not opinion, decides performance work and demonstrates using BenchmarkDotNet with release builds, warmups, return values and the memory diagnoser to get trustworthy comparisons. Shows concrete results: 336 ns vs 897 ns (~3x) for string Join versus LINQ Aggregate, IDictionary iteration suffers IDictionary boxing overhead (about 2x slower and more allocations), .NET Core string ops beat .NET Framework by ~2x, and a hybrid dictionary switches internal storage at nine items.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:03Premature optimization
- 7:05Coding tradeoffs
- 13:30How does perf work
- 14:12Aggregate method
- 19:13Benchmarking Dotnet
- 20:52How it works
- 21:22Writing a benchmark
- 25:28Benchmarking
- 31:08Simple benchmark
- 33:21String concatenation
- 39:29Dictionary
- 40:18Dictionary vs IDictionary
- 41:31Interfaces
- 42:37Loops vs Link
- 44:37Measuring the right thing
- 45:42Lower invariant
- 46:11Dotnet Framework
- 47:15Open to anything
- 47:57Hybrid Dictionary
- 50:10Summary
related talks
47mUnlocking Performance Improvements in .NET
44m.NET Performance Investigation
01h 06mGet Better App Performance with this One Weird Trick
01h 03mThe performance loop—A practical guide to profiling and benchmarking
37mRock Your Code Code and App Performance for Microsoft .Net
01h 03mApplication Performance Optimisation in Practice
46mHigh Performance .NET
48mPerformance in the .NET Runtime
