Uploaded October 2017 | Updated November 2026, 3 hours ago
In order to write efficient and performant code, one has to understand what costs us performance and how not to pay that cost. In this session, we dive into the .NET/C# memory model to gain a better/deeper understanding of what happens in memory when we instantiate various types of classes and structs, and how best to take advantage of this knowledge. We dive deeper still into the hardware, to better understand how modern CPUs and associated hardware such as CPU cache, DRAM, Prefetcher and Branch prediction etc. work together and how, the way we write code can have a huge impact on the performance of our applications. More articles and Programming With Intent chapters: matlus.com
Read the article: matlus.com/writing/dotnet-memory-allocations
In order to write efficient and performant code, one has to understand what costs us performance and how not to pay that cost. In this session, we dive into the .NET/C# memory model to gain a better/deeper understanding of what happens in memory when we instantiate various types of classes and structs, and how best to take advantage of this knowledge. We dive deeper still into the hardware, to better understand how modern CPUs and associated hardware such as CPU cache, DRAM, Prefetcher and Branch prediction etc. work together and how, the way we write code can have a huge impact on the performance of our applications. More articles and Programming With Intent chapters: matlus.com
Read the article: matlus.com/writing/dotnet-memory-allocations










