State of the Web: WebAssembly
By AsyncBanana on January 1, 2022 (Updated January 9, 2022)
WebAssembly (WASM) is a new assembly-like language on the web that aims to allow developers to write fast, portable code in the language of their choice. It is currently usable in all modern browsers and Node.js, and some WebAssembly only runtimes.
Background of WebAssembly
Why WebAssembly is significant
Another performance problem with WebAssembly is the high overhead for calling web APIs from WebAssembly. Mozilla has optimized this, but Chrome and Node.js still have this problem. However, WebAssembly performance is improving, and eventually, it might even be possible to get native performance with WebAssembly.
The Current State of WebAssembly
Widespread WebAssembly adoption is still far away, but it is making progress. Now we will look at the state of WebAssembly in web browsers, on servers, and the best languages to use.
If you are trying to create a complete web application using WebAssembly, the easiest way to do that as of now is using Rust and a framework such as Yew with Trunk. However, because of the small ecosystem, WebAssembly is currently best for small performance focused parts of an application rather than whole applications.
WebAssembly on the server is quickly growing. WebAssembly offers ultralight isolation, which makes it great for serverless functions because serverless functions need to start rapidly and have a low footprint. For an example of how this works, let’s look at how one of the most popular serverless function services, Cloudflare Workers, operates.
Cloudflare Workers executes serverless functions using V8 isolates rather than containers in separate processes. V8 isolates are lightweight V8 execution environments that start-up significantly faster than traditional sandboxed environments.
WebAssembly is still new to the world of the web. However, it is already finding a place in lightweight serverless function execution. I hope you have learned something from this, and this wraps up the first article in State of the Web. Thanks for reading!
If you would like to read about more up-and-coming technologies, make sure to sign up for the newsletter!