As I'm sure you have already heard, .NET 6 was released on November 8th, 2021, and I have to say as much as I've been testing/playing with the preview releases real-life usage shows some of the highlights of this release. You can scour the linked announcement and all associated items for fun new stuff included; the list is plentiful. However, I thought I'd take this time to dive in with the performance side of things.
Performance, Performance, and More Performance
You can often find the extent of the improvements included in a release based on what items in the "big announcement" get additional detailed announcements. Performance improvements received not only big notes in the actual announcement but additionally two detailed articles; Performance Improvements in .NET 6 and File IO Improvements in .NET 6.
These articles dive into some detailed technical analysis which I can appreciate; however, many developers don't find that information as "fun" as I do. So rather than diving into the specifics of what all is improved, I thought it would be beneficial to move a few production workloads to .NET 6 and compare some key metrics between old and new, with the ONLY change being .NET 5 to 6.
The Scoring Targets
For testing, I wanted to focus on a few key metrics that I could easily compare before & after metrics. The following metrics were collected as part of this exercise.
- Largest Contentful Paint (LCP) - How long it takes the largest visual element to paint
- Total Blocking Time - How much time was spent blocked by scripts
- Time to First Byte (TTFB) - How long it took to get the first byte of the response
- Time to Interactive - How long until you can interact with the site
- Fully Loaded Time - How long the entire website load took
I selected these metrics as they relate directly to how a site feels to visitors, and some are part of the Google Core Web Vitals, which can impact SEO placement.
The Test Subject
I've completed this testing against four different sites of similar architecture and will be sharing detailed results of the testing for this website. I focused testing on two critical path pages, the homepage and the blog landing page. However, results proved to be consistent for sub-sections as well.
I collected metrics BEFORE the upgrade to .NET 6, upgraded the project to .NET 6 only changing the target and re-publishing, and re-tested the site. I used an average over 3 tests each time to account for variable internet connectivity etc.
|Largest Contentful Paint (LCP)||931ms||655ms||29.7%|
|Total Blocking Time||26ms||0|
|Time to First Byte (TTFB)||172ms||161ms||6.4%|
|Time to Interactive||921ms||342ms||62.9%|
|Fully Loaded Time||931ms||656ms||29.5%|
Overall a great improvement in performance. I saw similar numbers with other sites that I tested this on.
The Blog Page
This page is a little more lightweight in operation and includes more images, so its baseline was faster, however, the upgraded page still showed gains.
|Largest Contentful Paint (LCP)||565ms||436ms||22.8%|
|Total Blocking Time||17ms||0ms|
|Time to First Byte (TTFB)||173ms||173ms||0%|
|Time to Interactive||565ms||401ms||29.0%|
|Fully Loaded Time||773ms||619ms||19.9%|
It's always nice when you can do a quick "update" and walk away with tangible performance improvements. We get this, and so much more with .NET 6! Are you seeing the same thing across your projects?