Skip to content
Ian Griffiths By Ian Griffiths Technical Fellow I · 11 min read
How .NET 11.0 boosted AIS.NET performance by 2%

TLDR; .NET 11.0 increased performance in our Ais.NET library by 2% with no code changes. For non-trivial processing, performance is well over twice as fast as it was on .NET Core 3.1. A modern desktop computer can process 12.2 million messages per second on a single thread!

At endjin, we maintain Ais.Net, an open source high-performance library for parsing AIS messages (the radio messages that ships broadcast to report their location, speed, etc.). Each time a new version of .NET ships, we check it all still works and then run our benchmarks again. Each year, we've seen significant improvements:

So what about .NET 11.0? The short answer is that yet again it is faster, although by a smaller margin than in previous years. However, to be able to continue to make meaningful comparisons, we need to rebaseline the existing results.

Benchmark results

Old versions, new hardware

I have retired the desktop I had been using when I first started benchmarking this library. So to be able to provide a meaningful comparison, I've had to rerun the benchmarks on all the older runtimes, to make these figures directly comparable. Here are all the results for every version of .NET previously tested on, but running on my new desktop, which has an AMD Ryzen 9 9900X3D processor.

Programming C# 12 Book, by Ian Griffiths, published by O'Reilly Media, is now available to buy.

.NET Core 2.1

I was no longer able to get the benchmark to build and run on a runtime this old. It has been out of support for over 5 years.

.NET Core 3.1

Method Mean Error StdDev Allocated
InspectMessageTypesFromNorwayFile1M 155.4 ms 1.29 ms 1.08 ms 25 KB
ReadPositionsFromNorwayFile1M 207.1 ms 1.83 ms 1.71 ms 25 KB

This corresponds to a maximum message processing rate of 6.4M message per second, or 4.8M/s when reading some basic information from the message. (On my old desktop, we got 3.0M/s and 2.6M/s respectively.)

.NET 6.0

Method Mean Error StdDev Allocated Improvement
InspectMessageTypesFromNorwayFile1M 133.4 ms 0.68 ms 0.53 ms 4 KB 16%
ReadPositionsFromNorwayFile1M 167.8 ms 1.03 ms 0.86 ms 5 KB 23%

This corresponds to a maximum message processing rate of 7.5M message per second, or 6.0M/s when reading some basic information from the message. (On my old desktop, we got 3.8M/s and 3.1M/s respectively.)

.NET 7.0

Method Mean Error StdDev Allocated Improvement
InspectMessageTypesFromNorwayFile1M 116.8 ms 1.14 ms 0.95 ms - 14%
ReadPositionsFromNorwayFile1M 154.7 ms 1.31 ms 1.22 ms - 8%

This corresponds to a maximum message processing rate of 8.6M message per second, or 6.5M/s when reading some basic information from the message. (On my old desktop, we got 4.7M/s and 3.7M/s respectively.)

.NET 8.0

Method Mean Error StdDev Allocated Improvement
InspectMessageTypesFromNorwayFile1M 100.2 ms 1.11 ms 1.04 ms - 17%
ReadPositionsFromNorwayFile1M 114.0 ms 1.06 ms 0.94 ms - 36%

This corresponds to a maximum message processing rate of 10.0M message per second, or 8.8M/s when reading some basic information from the message. (On my old desktop, we got 5.7M/s and 4.8M/s respectively.)

.NET 9.0

Method Mean Error StdDev Allocated Improvement
InspectMessageTypesFromNorwayFile1M 87.71 ms 0.490 ms 0.410 ms 4 KB 14%
ReadPositionsFromNorwayFile1M 101.65 ms 0.625 ms 0.585 ms 4 KB 12%

This corresponds to a maximum message processing rate of 11.4M message per second, or 9.8M/s when reading some basic information from the message. (On my old desktop, we got 6.4M/s and 5.2M/s respectively.)

.NET 10.0

Method Mean Error StdDev Allocated Improvement
InspectMessageTypesFromNorwayFile1M 83.22 ms 0.491 ms 0.436 ms 4 KB 5%
ReadPositionsFromNorwayFile1M 96.99 ms 0.710 ms 0.555 ms 4 KB 5%

This corresponds to a maximum message processing rate of 12.0M message per second, or 10.3M/s when reading some basic information from the message. (On my old desktop, we got 6.8M/s and 5.6M/s respectively.)

And now: .NET 11.0

It's worth noting that the version-on-version improvements I see on my new desktop don't always match what I observed running the same benchmarks on my older machine. For the simple message-type inspection benchmark, the gains are mostly smaller on the new desktop, with the exception of .NET 9.0, which saw a larger increase. But for the more realistic position-reading benchmark, the picture is mixed: .NET 6.0 (23% versus the 20% reported back then), .NET 8.0 (36% versus 27%) and .NET 9.0 (12% versus 9%) all improved by more on the new desktop, while .NET 7.0 (8% versus 19%) and .NET 10.0 (5% versus 7%) improved by less. But now, what about .NET 11?

Method Mean Error StdDev Allocated Improvement
InspectMessageTypesFromNorwayFile1M 81.85 ms 0.414 ms 0.367 ms 4,605 B 1-2%
ReadPositionsFromNorwayFile1M 94.42 ms 0.947 ms 0.886 ms - 2-4%

This corresponds to a maximum message processing rate of 12.2M message per second, or 10.6M/s when reading some basic information from the message.

For the sixth year running, we're enjoying a free lunch, although by a much smaller margin this year. In fact, the gain is small enough that the margins of error mean that we can't report the exact improvement all that precisely. There's definitely an improvement, but it might be as low as 1% on the more pessimistic measure.

Even so, without making any changes whatsoever to our code, we still see a measurable improvement simply by running the code on .NET 11.0 instead of .NET 10.0. As with last time, we've not had to release a new library version—the existing version published on NuGet (which targets netstandard2.0 and netstandard2.1) runs faster just as a result of upgrading your application to .NET 11.0.

Our memory usage is roughly the same. You will probably have noticed the reported allocation varying between nothing and about 4K (with .NET Core 3.1 being an outlier at 25KB) but this actually varies from test to test even within a single runtime. As far as I can tell it's random as to whether the benchmark actually sees this initialization cost. What matters though is that our amortized allocation cost per record continues to be 0 bytes. The total memory usage including startup costs is very similar: a handful of kilobytes, depending on exactly which features you use.

Free performance gains over time

The bottom line is that just as moving your application onto .NET 10.0 may well have given you an instant performance boost with no real effort on your part (as did moving to .NET 9.0, before that, and .NET 8.0, before that, and .NET 7.0, before that, and .NET 6.0 before that) you may enjoy another boost upgrading to .NET 11.0. It is a more modest boost, but it's still a free improvement.

We've been running these benchmarks across 8 versions of .NET now (.NET Core 2, .NET Core 3.1, .NET 6.0, .NET 7.0, .NET 8.0, .NET 9.0, .NET 10.0, and .NET 11.0) enabling us to visualize how performance has improved across these releases for our library. (I've had to drop .NET Core 2 from these graphs because I couldn't get the benchmarks to run on this long-out-of-support runtime on my new machine.) First we'll look at the time taken to process 1 million AIS messages:

Each .NET release has brought improvements, so let's look at the version-over-version performance gains:

And next, the throughput in AIS messages per second (same benchmarks, just a different way to present the results):

Finally, let's look at the cumulative performance improvements since .NET Core 3.1:

Over the time the AIS.NET library has existed, performance for non-trivial processing has improved by well over double, thanks entirely to improvements in the .NET runtime!

Learn more about AIS.NET

You can learn more about our Ais.Net library at the GitHub repo, http://github.com/ais-dotnet/Ais.Net/ and in the same ais-dotnet GitHub organisation you'll also find some other layers, as illustrated in this diagram:

A diagram showing the Ais.Net library layering as three rows. The top row provides this description of Ais.Net.Receiver: AIS ASCII data stream ingestion using IAsyncEnumerable. Decoded message available via IObservable. The second row provides this description of Ais.Net.Models: Immutable data structures using C# 9.0 Records. Interface expose domain concepts such as position. The third row provides this description of Ais.Net: high performance, zero-allocation decode using Span<T>. ~3 million messages per second per core.

Note that there is a separate repository for Ais.Net.Models. And there's another for the Ais.Net.Receiver project. If you would like to experiment with this library, you will find some polyglot notebooks illustrating its use at https://github.com/ais-dotnet/Ais.Net.Notebooks

FAQs

How much faster is AIS.NET on .NET 11.0 compared to .NET 10.0? The AIS.NET library runs approximately 2% faster on .NET 11.0 compared to .NET 10.0, with the more realistic benchmark showing processing rates increasing from 10.3 million messages per second to 10.6 million messages per second.
Do I need to update my AIS.NET code to benefit from .NET 11.0 performance improvements? No code changes are required. The existing AIS.NET version published on NuGet, which targets netstandard2.0 and netstandard2.1, runs faster simply by upgrading your application to .NET 11.0.
What is the cumulative performance improvement in AIS.NET since .NET Core 3.1? Exact results will depend on what hardware you run on, but performance has roughly doubled since .NET Core 3.1.
What is the maximum message processing rate achievable with AIS.NET on modern hardware? On a desktop with an AMD Ryzen 9 9900X3D CPU, running on a single thread AIS.NET can process 12.2 million messages per second for basic inspection and 10.6 million messages per second with a more realistic workload.

Ian Griffiths

Technical Fellow I

Ian Griffiths

Ian has worked across an extraordinary breadth of computing - from embedded real-time systems and broadcast television to medical imaging and cloud-scale architectures. As Technical Fellow at endjin, he brings this deep cross-domain experience to bear on the hardest technical problems.

A 17-time Microsoft MVP in Developer Technologies, Ian is the author of O'Reilly's Programming C# 12.0 and one of the foremost authorities on the C# language and high-performance .NET development. He's a maintainer of Reactive Extensions for .NET, Reaqtor, and endjin's 50+ open source projects.

Ian has created Pluralsight courses on WPF fundamentals, WPF advanced topics, WPF v4, and the TPL, and has given over 20 talks at conferences worldwide. Technology brings him joy.