C# Performance - Demons, Wizards, Warriors, Auditors
summary
Shows a concrete pitfall: using a default struct for 10,000 color values leads to 50 million equals calls and timings jumping from ~15 ms to ~500 ms due to poor default GetHashCode, padding and boxing. Replacing with an explicit GetHashCode plus IEquatable<T> collapses the cost; record structs also perform well. Measurement uses JetBrains profiler (tracing) to find hotspots and BenchmarkDotNet for accurate timings; lesson: measure, then fix the hash/equality and boxing.
AI-written summary · about
chapters (10)
- 0:00Introduction and motivation
- 6:12C# type system fundamentals
- 12:25Garbage collection and structs
- 16:43Equality, boxing, and strings
- 26:26Hash sets and performance
- 35:07Optimizing hash implementations
- 47:50Advanced C# types and benchmarks
- 53:36Benchmarking C# and C++
- 1:06:50Conclusion and resources
- 1:10:30Q&A session
related talks
01h 01mTurbocharged: Writing High-Performance C# and .NET Code
49mEngineering & Technical Highlight: Let's Do Some Crimes. The wonders of abusing C# generics.
58mTransforming Your C# Code to Functional Style
01h 00mWriting Allocation Free Code in C#
56mChange your habits: Modern techniques for modern C#
53mSafety first! Low-level C# without the unsafe keyword
01h 00mF# for the C# Developer - F#, the .NET Runtime, and Aesthetics
01h 02mAbusing C#
