WebAssembly is a Cross-Platform, Cross-Browser Solution for High Performance Code in Web Browsers

Most code running in a web browser runs much slower than native code (C/C++/ assembly), and it’s fine for many applications, but some others requiring higher performance like software video decoding would have to relies on native code, initially provided via browser plugins, but then Google introduced PNaCL (Portable Native Client) allowing to run native code on multiple targets (ARM, Intel, etc..) but in Chrome browser only, and now one of Chrome developers has explained that the community has moved to WebAssembly.

WebAssembly works just as well as PNaCl, and is already natively supported by Chrome and Firefox, with support added to preview versions of Microsoft Edge and Apple Safari browsers.Since it works just as well as PNaCL, and adoption of the later is low enough, Google decided to drop support for PNaCl in the Chrome browser in Q1 2018, except inside Chrome Apps and Extensions.

WebAssembly Unity WebGL Game Demo

To get a feel for the performance and capabilities, you can find a few demos on WebAssembly website:

The latter demo also compares the performance for the same task between WebAssembly and JavaScript, and in the screenshot below we can see WASM (short name for WebAssembly) is 80% faster than JS (JavaScript) while applying “Sunset” filter to the video in Firefox.

Click to Enlarge

You’ll find the source code of the demo in Github. It’s still far from the performance of desktop app, but a big improvement over JavaScript.

If you’ve ever made a native web app relying on PNaCl, Google has provided a set of recommendation to help migration to WASM.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

One Reply to “WebAssembly is a Cross-Platform, Cross-Browser Solution for High Performance Code in Web Browsers”

  1. It’s closer to what Java had hoped for. It’s roughly on a par with PNaCL, which is part of the reason Google’s dropping the one for the other. You get it with all the mainline browsers and it seems to run well enough between Linux, OSX, and Windows.

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC