Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Google Chrome 70 now supports WebAssembly threads to build multi-threaded web applications

Save for later
  • 2 min read
  • 30 Oct 2018

article-image

Yesterday, Google announced that Chrome 70 now supports WebAssembly threads. The WebAssembly Community Group has been working to bring the support for threads to the web and this is a step towards that effort. Google’s open source JavaScript and WebAssembly engine, V8 has implemented all the necessary support for WebAssembly threads.

Why the support for WebAssembly threads is needed?


Earlier, parallelism in browsers was supported with the help of web workers. The downside of web workers is that they do not share mutable data between them. Instead, they rely on message-passing for communication.

On the other hand, WebAssembly threads can share the same Wasm memory. The underlying storage of shared memory is enabled by SharedArrayBuffer, a JavaScript primitive that allows sharing the contents of a single ArrayBuffer concurrently between workers. Each WebAssembly thread runs in a web worker, but their shared Wasm memory allows them to work as fast as they do on native platforms. This means that those applications which use Wasm threads are responsible for managing access to the shared memory as in any traditional threaded application.

How you can try this support


To test the WebAssembly module you need to turn on the experimental WebAssembly threads support in Chrome 70 onwards:

  1. First, navigate to the chrome://flags URL in your browser:


google-chrome-70-now-supports-webassembly-threads-to-build-multi-threaded-web-applications-img-0

Source: Google Developers


  1. Next, go to the experimental WebAssembly threads setting:
  2. Unlock access to the largest independent learning library in Tech for FREE!
    Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
    Renews at $19.99/month. Cancel anytime


google-chrome-70-now-supports-webassembly-threads-to-build-multi-threaded-web-applications-img-1

Source: Google Developers


  1. Now change the setting from Default to Enabled and then restart your browser:


google-chrome-70-now-supports-webassembly-threads-to-build-multi-threaded-web-applications-img-2

Source: Google Developers


The aforementioned steps are for development purposes. In case you are interested in testing your application out in the field, you can do that with origin trial. Original trials allow you to try experimental features with your users by obtaining a testing token that’s tied to your domain.

You can read more in detail about the WebAssembly thread support in Chrome 70 on the Google Developers blog.

Chrome 70 releases with support for Desktop Progressive Web Apps on Windows and Linux

Testing WebAssembly modules with Jest [Tutorial]

Introducing Walt: A syntax for WebAssembly text format written 100% in JavaScript and needs no LLVM/binary toolkits