Benchmarks indicate big performance improvements in .NET 6
The upcoming next major version of Microsoft .NET, .NET 6, improves performance of many operations significantly according to Microsoft's benchmark tests.
A new post on the Dotnet developer blog by Stephen Toub,
Partner Software Engineer, .NET, offers insights on the benchmark tests and the performance improvements compared to previous versions of .NET.
According to the post, about 6500 merged pull requests landed in .NET 6, excluding automated pull requests by bots. Of these, about 550 improve performance in one area or another, according to Microsoft.
The post is technical in nature; it contains a lot of code, examples and instructions to run the benchmark to verify the results. BenchmarkDotNet was used for the majority of results.
As examples, here are the benchmark results of Just In Time benchmark tests. Most tests compare the performance of .NET 6.0 with .NET 5.0, but you find other .NET versions used in some of the tests as well.
|Format||.NET 5.0||13.21 ns||1.00||1,649 B|
|Format||.NET 6.0||10.37 ns||0.78||590 B|
|Find||.NET Framework 4.8||115.4 us||1.00||127 B|
|Find||.NET Core 3.1||69.7 us||0.60||71 B|
|Find||.NET 5.0||69.8 us||0.60||63 B|
|Find||.NET 6.0||53.4 us||0.46||57 B|
|GetLength||.NET Framework 4.8||6.3495 ns||1.000||106 B||32 B|
|GetLength||.NET Core 3.1||4.0185 ns||0.628||66 B||–|
|GetLength||.NET 5.0||0.1223 ns||0.019||27 B||–|
|GetLength||.NET 6.0||0.0204 ns||0.003||27 B||–|
|PGO Disabled||1.905 ns||30 B|
|PGO Enabled||0.7071 ns||105 B|
|Sum||.NET 5.0||471.3 us||
|GetHeight||.NET 5.0||151.7852 ns||1.000||179 B|
|GetHeight||.NET 6.0||0.0000 ns||0.000||12 B|
|Format||.NET 5.0||87.71 ns||1.000||154 B|
|GetHeight||.NET 6.0||51.88 ns||0.59||100 B|
You can check out the full blog post at the Dot Net Dev Blog for a full rundown of all tests, code examples, and explanations why performance improved for a particular benchmark test.
Developers interested in .NET may download the latest preview release, .NET 6.0 Preview 7 at the time of writing, from Microsoft's Developer website. It is available for Windows (ARM, x64, x32), Linux (Arm32, Arm64, x64) and Mac OS X (Arm64, x64). Only binaries provided for Linux, installers and binaries for Windows and Mac OS.
Now You: do you use applications that require .NET?
When will be W10 or W11 realeased with NET 6.0 inside? Any way to upgrade it from 4.8 to 6.0? :[
There is no path from 4.8 to 6.0.
4.8 will be the last .NET Framework release. .NET 6 (formerly .NET Core) represents an entirely new development paradigm for Microsoft. The biggest takeaway with .NET 6 is that Microsoft has gone all-in on cross-platform development. Now any programs developed with .NET 6 can be easily compiled for Mac, Linux, even Android and iOS. .NET 5 laid a lot of the groundwork for this to happen but .NET 6 is when the new era officially begins. There is no better time to be a C# programmer than now.
It’ll be installed separately similar to all the Visual C++ versions you may have, depending on whether they’re needed, which can be seen in Programs and Features. If you click Turn Windows and Features on and off, the first entry is dotNet’s.
Follow the link Martin provided and nightlys can be downloaded.
Real world scenarios no one will notice.
Every optimization helps applications appear snappier. Its subtle in most cases, very noticeable in others. I know Java was bragging that they ran just a few percent faster; I’m not sure that’s true anymore. I’ll upgrade to .NET 6 just on performance improvements alone.
As always, awesome! Thanks for these .NET posts!