News

Edge Browser Switches WebAssembly to 'On'

For the first time, the Microsoft Edge Web browser provides out-of-the-box support for WebAssembly, the experimental technology that lets developers write Web code in non-JavaScript languages like C, C++ and even -- with a little work -- .NET languages like C#.

This new functionality comes in the updated Microsoft Edge version called EdgeHTML 16 -- and its Chakra JavaScript engine -- that ships with the Windows 10 Fall Creators Update being rolled out worldwide.

EdgeHTML and Chakra previously supported the experimental WebAssembly with an initial effort called WebAssembly Minimum Viable Product (MVP), kind of a proof of concept that lacks various important features.

Along with other new features -- SharedArrayBuffer and support for Atomics -- the MVP WebAssembly functionality was disabled by default with an "Experimental JavaScript Features" flag.

In the latest iteration of EdgeHTML 16, those features have been fine-tuned, stabilized and enabled by default, buttressed by many tweaks that have improved performance.

Just about 2-1/2 years since it was first announced, WebAssembly might not be familiar to some Web jockeys. Developers don't write code in the WebAssembly binary bytecode format ("wasm" files), but rather they can write in other languages that are compiled into WebAssembly.

Although WebAssembly in certain implementations can reportedly relieve Web developers from "the insanity of JavaScript," it's tightly intertwined with the ubiquitous Web language and has been described as being evolved from JavaScript or even being a subset of JavaScript.

As a primary backer of the project -- the Mozilla Developer Network (MDN) around the Firefox Web browser -- puts it:

WebAssembly is a new type of code that can be run in modern Web browsers -- it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as C/C++ with a compilation target so that they can run on the Web. It is also designed to run alongside JavaScript, allowing both to work together.

Mozilla and other browser makers are helping to shepherd the new technology approach as an open standard under a W3C Community Group.

While WebAssembly may have been flying under the radar in some mainstream Web development circles, it promises radical implications for the traditionally JavaScript/HTML/CSS-dominated space.

Putting it bluntly, Mozilla developer David Bryant said: "WebAssembly is one of the biggest advances to the Web Platform over the past decade."

And that carries over into the .NET ecosystem too, though it takes a bit more work to leverage WebAssembly in languages such as C#.

C# Code for the Web
[Click on image for larger view.] C# Code for the Web (source: Scott Hanselman).

Cautioning that "this is just an experiment," Microsoft developer Steven Sanderson this summer posted a YouTube video on WebAssembly and other new technologies titled "Web Apps can't really do *that*, can they?" Commenting on one part of the video that used C code, one developer on Reddit noted: "The big browsers are really working on integration of other languages and debugging of them live in the browser. No mapping for C# code though, since the C# code is not compiled directly to webassembly, but interpreted by the small dotnetanywhere runtime."

Sanderson was able to write the traditional JavaScript Todo app with C#, however.

There are also other efforts underway to wed .NET and WebAssembly, as Microsoft's Scott Hanselman pointed out in an August post titled ".NET and WebAssembly -- Is this the future of the front-end?" in which he noted: "Today in 2017, WebAssembly is absolutely a thing."

Hanselman reported on Sanderson's presentation and detailed some of these other efforts, including the WebAssembly for .NET project and the mono-wasm project. The former is intended to "to consume WASM binary files and execute them from within .NET assemblies" while the latter is described as "a proof-of-concept aiming at building C# applications into WebAssembly, by using Mono and compiling/linking everything statically into one .wasm file that can be easily delivered to browsers." Mono, of course, is the open source runtime that was turned into Xamarin.

"We have been experimenting with a couple of approaches to bring Mono to the Web using WebAssembly -- a technology that can efficiently and safely execute code in Web browsers without being limited to JavaScript," said Mono/Xamarin chief Miguel de Icaza in an August blog post. "Running code written in C or C++ inside the browser has been a big motivator, but most major programming languages have plans to target WebAssembly as a platform."

Meanwhile, the EdgeHTML team will continue work to support WebAssembly. Already, the aforementioned tweaks to the initial MVP offering have paid off in better performance. "Several changes also help improve WebAssembly performance in Chakra by 20-25 percent on workloads we have been tracking," said Limin Zhu, a Microsoft program manager, in a blog post last week . "Try it out for yourself! Point Microsoft Edge at a fun WebAssembly game like Funky Karts to see the improvement with no flags required!"

Zhu said Microsoft will continue its close work with Mozilla, Google, Apple and other WebAssembly backers to improve the initiative. "Impactful post-MVP features such as threads and GC [garbage collection] are currently being explored in the WebAssembly Community Group," he said.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Mastering Blazor Authentication and Authorization

    At the Visual Studio Live! @ Microsoft HQ developer conference set for August, Rockford Lhotka will explain the ins and outs of authentication across Blazor Server, WebAssembly, and .NET MAUI Hybrid apps, and show how to use identity and claims to customize application behavior through fine-grained authorization.

  • Linear Support Vector Regression from Scratch Using C# with Evolutionary Training

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the linear support vector regression (linear SVR) technique, where the goal is to predict a single numeric value. A linear SVR model uses an unusual error/loss function and cannot be trained using standard simple techniques, and so evolutionary optimization training is used.

  • Low-Code Report Says AI Will Enhance, Not Replace DIY Dev Tools

    Along with replacing software developers and possibly killing humanity, advanced AI is seen by many as a death knell for the do-it-yourself, low-code/no-code tooling industry, but a new report belies that notion.

  • Vibe Coding with Latest Visual Studio Preview

    Microsoft's latest Visual Studio preview facilitates "vibe coding," where developers mainly use GitHub Copilot AI to do all the programming in accordance with spoken or typed instructions.

  • Steve Sanderson Previews AI App Dev: Small Models, Agents and a Blazor Voice Assistant

    Blazor creator Steve Sanderson presented a keynote at the recent NDC London 2025 conference where he previewed the future of .NET application development with smaller AI models and autonomous agents, along with showcasing a new Blazor voice assistant project demonstrating cutting-edge functionality.

Subscribe on YouTube