ARN

Microsoft .NET 7 Preview 3 focuses on speed-ups

Full native ahead-of-time compilation, start-up time, and GC overhead improvements get attention in the latest preview of the next major version of Microsoft’s software development platform.

With Preview 3 of Microsoft’s planned .NET 7 software development platform, Redmond has updated capabilities in areas such as Native AOT (ahead of time) compilation, code generation, GC regions, and start-up times.

Available from dotnet.microsoft.com, Microsoft .NET 7 Preview 3 was released April 13. Native AOT, which promises full native pre-compilation in .NET desktop client and server scenarios, has been updated. 

For .NET 7, Microsoft is targeting console apps and native libraries as the primary scenarios for Native AOT. Developers and library authors now can take advantage of Native AOT by ensuring that applications are trimmable, which is a requirement for Native AOT.

One of the apps expected to be compiled with Native AOT in .NET 7 is the crossgen tool, which serves as the CoreCLR AOT compiler that produces ReadytoRun executables. 

Crossgen has shown promise in terms of compilation speed and size. Moving forward, Native AOT compatibility will be improved in .NET, but there will be reasons to prefer JIT (just in time) compilation for many scenarios, Microsoft said.

Native AOT was moved out of experimental status and into mainline development with .NET 7. Native AOT brings advantages in startup time, memory usage, access to restricted platforms, and smaller size on disk. Only native artifacts are produced via Native AOT.

Microsoft .NET 7 Preview 3 follows a second preview published March 14. A production release is expected in November 2022. To try .NET 7 with Visual Studio, Microsoft recommends using preview channel builds.

When assessing other new features and enhancements in .NET 7 Preview 3, start-up times have been improved with Write-Xor-Execute enabled and code generation and JIT now benefit from several optimisations and bug fixes.

Meanwile, working with cryptography certificates was made simpler with the introduction of a class that provides more clarity for parsing X.500 names. In addition, GC regions functionality, which should improve memory utilisation for high-throughput applications, has been enabled by default -- it is enabled now for all platforms except MacOS and Native AOT.

Delving deeper, the Managed Extensibility Framework was updated to align with APIs from the previous version -- these APIs allow a single object instance to the System.Composition.Hosting container. Also, support for the cloud native OpenTelemetry specification was enhanced to make the trace state mutable for samplers.