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

comments powered by Disqus


  • 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