Metaprogramming for the masses
summary
Shows how to coax the .NET JIT into emitting faster code by using struct strategy types (value-type generics that let the JIT delete dead branches and avoid allocations), a practical code pruning unrolling pattern that removes bounds checks and gives near-manual unroll performance, and swapping an interface-backed matrix for an interface→struct storage swap to recover a ~4x cost. Includes working C# examples, emitted assembly notes, and a repo of experimental allocators.
AI-written summary · about
chapters (9)
- 0:00Introduction to Metaprogramming
- 1:33Metaprogramming in C#
- 4:26Performance vs. Maintainability
- 7:51Structs and Constants
- 13:26Recursive Structural Types
- 23:45High Performance Techniques
- 29:45Loop Unrolling
- 40:30Interface De-virtualization
- 51:13Conclusion and Q&A
related talks
52mPerformance features in C#
59mHigh-performance code design patterns in C#
01h 04mTurbocharged: Writing High-Performance C# and .NET Code
59mPerformance tricks I learned from contributing to open source .NET packages
56mState of the .NET Performance
45mThe Good, the Bad and the Surprising aspects of code compilation in .NET (C#)
48mManual Memory Management in .NET Framework
01h 14mTurbocharged: Writing High-performance C# and .NET code
