What the game industry taught me about performance
summary
Shows concrete, measurable techniques: uses BenchmarkDotNet on .NET Core 3.0, demonstrates cache-aware vs cache-unfriendly matrix loops (row wins), converts class-of-objects to compact arrays for a 7× speedup, applies SIMD via System.Numerics.Vector for up to 10× gains, replaces branches with sorting or bit tricks to avoid a 5× variance, and diagnoses parallel slowdown from false sharing, then fixes it with thread-local accumulation to regain near-linear scaling.
AI-written summary · about
chapters (42)
- 0:00Intro
- 1:52Why Care About Performance (again)?
- 4:15Executing Code - Fetch and Decode
- 4:27Executing Code - Process Instruction
- 4:38Keeping the CPU Busy - Pipelining
- 5:16Speculative Execution and Branching
- 5:52Incorrect Prediction
- 6:33Making Storage Faster by Caching
- 7:03Read Cache Line
- 7:31Populate Cache
- 7:50Multiple Caches and Multiple Copies of Data
- 8:11Writing Shared Data
- 8:30Cache Coherence
- 8:50Examples
- 9:47What About Garbage Collection?
- 10:40Traverse by Column
- 10:50Behind the Scene
- 11:27Benchmark: Row vs. Column
- 11:54The Profiler Hides the Truth
- 12:35Let's Blame the Compiler Then
- 15:11Indirection of Reference Types
- 16:00Benchmark: Classes vs. Structs
- 16:19Cache Pollution
- 16:43What Do We Need?
- 17:25Benchmark: Dedicated Arrays
- 18:10Setup
- 19:30Branch Prediction in a Nutshell
- 21:17Bonus Round: SIMD
- 21:55SIMD Implementation
- 23:29Perfect Parallelism
- 24:15Baseline: Simple Loop
- 24:29Let's Make it Parallel
- 24:54First attempt - Parallel.For
- 25:09Benchmark: Parallel.For
- 26:05Benchmark: Locking
- 26:38Lock Free - Dedicated Storage for each Result
- 27:21Benchmark: Lock Free
- 28:26Local Storage - Stack Variable
- 29:05Benchmark: Local Storage
- 30:04Performance is a Feature
- 31:20Keep Learning
- 31:55Summary and Thank You!
related talks
01h 02mThe performance loop—A practical guide to profiling and benchmarking
01h 02mApplication Performance Optimisation in Practice
51mPowerShell Techniques and Performance Tweaks - Full Throttle
01h 31mThe Full Show
52mRoad to .NET 6: migration story of hope and despair
59mOptimize for the Cloud – Lightning-speed .NET Container Apps
42mWhen the OS gets in the way
46mSupercharging PowerShell with LINQ
