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

  • Uno Platform Wants Microsoft to Improve .NET WebAssembly in Two Ways

    Uno Platform, a third-party dev tooling specialist that caters to .NET developers, published a report on the state of WebAssembly, addressing some shortcomings in the .NET implementation it would like to see Microsoft address.

  • Random Neighborhoods Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the random neighborhoods regression technique, where the goal is to predict a single numeric value. Compared to other ML regression techniques, advantages are that it can handle both large and small datasets, and the results are highly interpretable.

  • As Some Orgs Restrict DeepSeek AI Usage, Microsoft Offers Models and Dev Guidance

    While some organizations are restricting employee usage of the new open source DeepSeek AI from a Chinese company due to data collection concerns, Microsoft has taken a different approach.

  • Useful New-ish Features in .NET/C#

    We often hear about the big new features in .NET or C#, but what about all of those lesser known, but useful new features? How exactly do you use constructs like collection indices and ranges, date features, and pattern matching?

  • TypeScript 5.8 Beta Speeds Program Loads, Updates

    "TypeScript 5.8 introduces a number of optimizations that can both improve the time to build up a program, and also to update a program based on a file change in either --watch mode or editor scenarios."

Subscribe on YouTube