News

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 at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube