.NET Framework 4.8 v .NET 7 simple ADO.NET select performance benchmarks

I love it when an upgrade to the underlying .NET framework results in faster code without us actually having to change anything explicitly.

I found one example of this recently when I used BenchmarkDotNet to compare how long a simple ADO.NET select took using both .NET Framework 4.8 and .NET 7.

The results for the benchmarks which use Microsoft.Data.SqlClient (5.0.1) and select 1K and 100K records are below …

Click on the image for a larger view in a new window …

We can see .NET 7 is 23% and 33% faster than .NET Framework 4.8 when querying 1K and 100K records respectively.

While the absolute numbers are small these sort of ratio differences can make a big impact to many apps and show why it’s important to keep our apps running on the latest versions of .NET when we can.

Leave a Reply

Your email address will not be published. Required fields are marked *