Microsoft has officially released .NET Core 2.1 for all platforms. This release is intended to receive long term support, but according to Microsoft's Rich Lander, is not yet officially designated LTS. Lander says a small but significant number of updates will be added to this release before it is considered complete. Once it is official, this release will be supported as LTS for three years. For all .NET Core applications under active development, Lander says programmers should proceed to switching to 2.1 right now.
What will the switch to 2.1 provide? Beyond the soon to arrive LTS designation, 2.1 brings support for Ubuntu 18.04, Alpine Linux, and ARM32. It also adds self-contained application publishing and improved performance.
When looking at the performance gains, it should be noted that these represent a speed increase of 2.1 over .NET Core 2.0 in incremental build-time performance. Joining this is a brand new class, SocketsHttpHandler, which is a C# implementation of HttpClient. SocketsHttpHandler is much faster than previous implementations and provides consistent cross-platform behavior.
Microsoft's Stephen Toub describes in great detail the runtime performance improvements in 2.1. Some of these improvements come from the addition of System.Span<T> and related types. Other changes were made to the Just-In-Time (JIT) compiler used in .NET Core 2.1. An interesting addition is the ability to take advantage of tiered compilation. In this scenario, the JIT compiler generates executable as fast as possible with minimal optimizations. After this is completed, the JIT compiler will observe program operation, and heavily used methods will receive a second more optimized compilation pass. The theory is, why take time to optimize methods that may not be heavily used, if at all? This behavior is not activated by default, but can be activated with the following environment variable:
COMPlus_TieredCompilation="1"
Performance gains are not limited to code optimizations; the .NET Core team has also incorporated a new compression standard to reduce the size of data transmissions. Using an implementation based on C code from Google, Microsoft has added support for Brotli Compression to .NET Core 2.1. As Brotli is widely supported across many web browsers and web servers, it is helpful for this technology to be available and supported on .NET Core.
Finally .NET Core 2.1 provides support for self-contained deployments (SCD). This is the ability to generate a Release build of your application that includes all of the .NET Core runtime files needed to execute. While this takes up more disk space than a regular build, it provides developers with the control to specify what platforms the application will run and which version of .NET Core is used.
Full release notes for .NET Core 2.1 as well downloads for all supported platforms (Windows, macOS, and Linux) are available now.