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.
Method | Runtime | Mean | Ratio | Code Size |
---|---|---|---|---|
Format | .NET 5.0 | 13.21 ns | 1.00 | 1,649 B |
Format | .NET 6.0 | 10.37 ns | 0.78 | 590 B |
Method | Runtime | Mean | Ratio | Code Size |
---|---|---|---|---|
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 |
Method | Runtime | Mean | Ratio | Code Size | Allocated |
---|---|---|---|---|---|
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 | – |
Method | Mean | Code Size |
---|---|---|
PGO Disabled | 1.905 ns | 30 B |
PGO Enabled | 0.7071 ns | 105 B |
Method | Runtime | Mean | Ratio | Code Size | ||
---|---|---|---|---|---|---|
Sum | .NET 5.0 | 471.3 us |
|
54 B | ||
Sum | .NET 6.0 |
|
|
97 B |
Method | Runtime | Mean | Ratio | Code Size |
---|---|---|---|---|
GetHeight | .NET 5.0 | 151.7852 ns | 1.000 | 179 B |
GetHeight | .NET 6.0 | 0.0000 ns | 0.000 | 12 B |
Method | Runtime | Mean | Ratio | Code Size |
---|---|---|---|---|
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.
Recommended Comments
There are no comments to display.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.