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 for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube