Next for Blazor: AOT for 'Massive Speed Gains'
Officially listed as a "developer on the ASP.NET team," he's the guy who even used Blazor to create Flutter apps as a demonstration of its capabilities, though that's not something Microsoft is officially planning.
This is all done by changing the rendering target from the default, web, to those other areas.
As Microsoft's point person for Blazor, Daniel Roth (officially principal program manager for ASP.NET), said last year, "Blazor was architected from the beginning so that its renderer was extensible. The default renderer in Blazor renders HTML, and that's why you use Blazor to build Web applications, not too surprising there, but the renderer can be replaced. In fact you can replace it with a different renderer that renders to whatever you want like. You might render instead to native controls."
Since then, Blazor -- whose client-side component, Blazor WebAssembly, was just released in version 3.2 -- has targeted PWAs along with native mobile apps
At this week's online Build developer conference, Sanderson covered some of those in a presentation titled "Modern Web UI with Blazor WebAssembly."
"So maybe you are wondering what the Blazor team spends its time doing these days?" he said. "Well, the answer to that is, we are already hard at work on the next major release. We've got some big enhancements to Blazor planned for .NET 5, which includes some general component programming model improvements, which have been requested by the community, as well as some major items like hot reloading and CSS isolation."
Prominent in the list of planned improvements is ahead-of-time (AOT) compilation, something developers are eagerly awaiting. In fact, in response to our article announcing Blazor WebAssembly titled "Blazor Finally Complete as WebAssembly Joins Server-Side Component," a developer commented, "The AoT problem needs to be solved before they can decorate themselves with 'Complete.' "
The Uno Platform actually claimed an industry first with WebAssembly AOT in February, but it's on Microsoft's list as well as indicated by this GitHub issue: AoT compilation #5466 It was opened by Roth way back in January 2018, and this January he commented on it:
Yes, there has been progress. There is an implementation of AoT compilation to WASM in the https://github.com/mono/mono repo and the runtime has been updated to support executing a mixture of .NET IL and compiled WASM files. However, the AoT support will not be ready for the upcoming May release. We will revisit shipping it for .NET 5.
In announcing Blazor WebAssembly 3.2 preview 4 in April, Roth followed up:
The .NET runtime used by Blazor WebAssembly is doing IL interpretation – there's no JIT – so this does affect the performance of CPU intensive workloads. For .NET 5 we are looking at adding support for ahead of time (AoT) compilation that we enable precompiling hot paths to WebAssembly as a way to improve runtime performance.
Sanderson, in this week's presentation, offered more: "There are also some WebAssembly-specific enhancements that we're looking at, which includes the ability to pre-compile your dotnet code all the way to WebAssembly bytecode ahead of time, which can lead to some pretty massive speed gains." Those WebAssembly-specific improvements also include a multithreaded runtime and lazy loading.
In fact, those items and many more such improvements is presented in the Blazor Roadmap for .NET 5
This issue is going to list the big deliverables the Blazor team is considering for ASP.NET Core 5.0 release. While we hope to deliver all of these issues, there are still many unknown and things will change as we go. Please note, that these are the major investment areas and in parallel work will be happening to bring in many smaller fixes and enhancements including community contributions.
.NET 5, of course, is shipping in November, though some planned functionality has been delayed because of the COVID-19 pandemic.
- "JS is a devilish evil, and Angular is hell ;-)"
- "Thanks for the great presentation, hope you guys make genuine effort into making Blazor a complete replacement for js libraries so that i can stop learning new js libraries every week. if you guys actually push Blazor wasm , a large community will start using it and it could be the next react js or bigger. wasm ftw."
Reflecting the overall kudos for Sanderson's presentation, one developer chimed in: "Game changer! Fantastic job! Thank you!"
David Ramel is an editor and writer for Converge360.