C# Performance Recap
In this module, you got an introduction to C# performance optimization and the mindset required to do it well. You learned why optimizing too early is a mistake, drawing on the famous rules of Michael Jackson and Donald Knuth, and why you should always build clean, working code first before thinking about performance at all.
You also got a first look at the key concepts you will need to reason about performance on the .NET runtime: how memory is divided between the stack and the heap, what value types and reference types are, how boxing and unboxing works and why it is something to avoid, and why immutable strings behave the way they do. These are the building blocks that everything else in this course will build on.
Finally, you learned a practical framework for deciding what to optimize. Performance problems are rarely spread evenly across a codebase. In practice, only a small percentage of your code is responsible for the majority of bottlenecks, and your job is to find that hotspot through benchmarking, fix the weakest link in the chain, and only then move on to the next one.