Performance is a key focus of .NET 7, and all of its features are designed with performance in mind. In addition, .NET 7 includes the following enhancements aimed purely at performance:
On-stack replacement (OSR) is a complement to tiered compilation. It allows the runtime to change the code executed by a currently running method in the middle of its execution (that is, while it's "on stack"). Long-running methods can switch to more optimized versions mid-execution.
Profile-guided optimization (PGO) now works with OSR and is easier to enable (by adding to your project file). PGO can also instrument and optimize additional things, such as delegates.true
Improved code generation for Arm64.
Native AOT produces a standalone executable in the target platform's file format with no external dependencies. It's entirely native, with no IL or JIT, and provides fast startup time and a small, self-contained deployment. In .NET 7, Native AOT focuses on console apps and requires apps to be trimmed.
Performance improvements to the Mono runtime, which powers Blazor WebAssembly, Android, and iOS apps.
For a detailed look at many of the performance-focused features that make .NET 7 so fast, see the Performance improvements in .NET 7 blog post.