Contact Us

Blazor and ASP.NET Core Get Faster in .NET 5 — Visual Studio Magazine

Mobile App | January 5, 2021

Blazor and ASP.NET Core Get Faster in .NET 5

When looking at the updates to web development in the new .NET 5 milestone release, one thing stands out: speed.

“ASP.NET Core in .NET 5 is the fastest .NET web framework we’ve ever shipped!” said Microsoft this week in highlighting improvements to the web-dev component of the unifying .NET 5 framework.

ASP.NET Core, the open source, cross-platform successor to ASP.NET (part of the old .NET Framework), is also where Blazor lives, providing a C# option for web development. It allows for full-stack web development via two components: Blazor WebAssembly for the client side and Blazor Server for the server side. The red-hot project has been garnering a lot of attention in the Microsoft-centric development ecosystem and has seen steady performance increases.

“For .NET 5, we made significant improvements to Blazor WebAssembly runtime performance with a specific focus on complex UI rendering and JSON serialization,” Microsoft said in the release notes for .NET 5. “In our performance tests, Blazor WebAssembly in .NET 5 is two to three times faster for most scenarios.”

As shown in the charts below, the focus on JSON handling paid off well, along with grid rendering performance.


JSON Handling
[Click on image for larger view.] JSON Handling (source: Microsoft).

Grid Rendering
[Click on image for larger view.] Grid Rendering (source: Microsoft).

Microsoft previously explained the team improved runtime code execution in Blazor WebAssembly in .NET 5 over v3.2 with optimizations of the core framework libraries and improvements to the .NET IL interpreter. Along with JSON handling, that speeds up things like string comparisons, and dictionary lookups.

And those Blazor speed improvements were made without ahead-of-time (AOT) compilation, a much-requested feature that didn’t make it into the Nov. 10 debut of .NET 5 and is now instead targeted for .NET 6, coming in November 2021.

Along with Blazor, its parent ASP.NET Core framework also enjoys a speed boost in .NET 5, as mentioned above.

“.NET 5 contains great performance improvements in the runtime and libraries and for the gRPC components,” Microsoft said in a Nov. 10 post. “These improvements, when applied to ASP.NET Core, result in some significant wins in throughput (RPS) and latency.”


Performance Improvements
[Click on image for larger view.] Performance Improvements (source: Microsoft).

The above data comes from the TechEmpower benchmarks for ASP.NET Core with .NET Core 3.1 and from the latest results for ASP.NET Core with .NET 5. The ‘platform ‘tests represent highly optimized benchmark implementations, Microsoft said, while the non-platform tests use more typical framework components.

“The TechEmpower performance composite score, an index based on all of the TechEmpower benchmarks aggregated together, increased from 5,659 to 6,626 with .NET 5, which represents a 17 percent increase,” Microsoft said.”

And, as mentioned, even speedier performance is expected next year with .NET 6. As Microsoft’s Daniel Roth said earlier, “You can expect ongoing work to improve Blazor WebAssembly performance. Besides optimizing the Blazor WebAssembly runtime and framework, the .NET team is also working with browser implementers to further speed up WebAssembly execution. And for .NET 6, we expect to ship support for ahead-of-time (AoT) compilation to WebAssembly, which should further improve performance.”

About the Author


David Ramel is an editor and writer for Converge360.

This content was originally published here.