.NET 6 v .NET 7 reflection performance benchmarks

.NET 7 (Preview 5+) has some awesome performance improvements when it comes to reflection functionality like invoking methods BUT there appears to be some regressions too.

Here’s the timings I got when I benchmarked simple reflection scenarios which I got (and modified slightly) from Khalids excellent Common Use Cases For .NET Reflection article…

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

As we can see there’s some pretty awesome improvements around invoking methods which is an approach used extensively in .NET land so these speed improvements should help a lot of apps.

At least for my run there appears to be a slight regression when accessing a private field. I’ll try the benchmarks again after .NET GA in November 2022 to see if this regression has been removed or lessened.

Leave a Reply

Your email address will not be published.