Book Image

Practical WebAssembly

By : Sendil Kumar Nellaiyapen
Book Image

Practical WebAssembly

By: Sendil Kumar Nellaiyapen

Overview of this book

Rust is an open source language tuned toward safety, concurrency, and performance. WebAssembly brings all the capabilities of the native world into the JavaScript world. Together, Rust and WebAssembly provide a way to create robust and performant web applications. They help make your web applications blazingly fast and have small binaries. Developers working with JavaScript will be able to put their knowledge to work with this practical guide to developing faster and maintainable code. Complete with step-by-step explanations of essential concepts, examples, and self-assessment questions, you’ll begin by exploring WebAssembly, using the various tools provided by the ecosystem, and understanding how to use WebAssembly and JavaScript together to build a high-performing application. You’ll then learn binary code to work with a variety of tools that help you to convert native code into WebAssembly. The book will introduce you to the world of Rust and the ecosystem that makes it easy to build/ship WebAssembly-based applications. By the end of this WebAssembly Rust book, you’ll be able to create and ship your own WebAssembly applications using Rust and JavaScript, understand how to debug, and use the right tools to optimize and deliver high-performing applications.
Table of Contents (15 chapters)
1
Section 1: Introduction to WebAssembly
5
Section 2: WebAssembly Tools
9
Section 3: Rust and WebAssembly

Preface

Delivering high-performance applications is a nightmare. JavaScript is a dynamically typed language. Thus, the JavaScript engine assumes the type when executing JavaScript. These assumptions lead to unpredictable performance. This makes it even harder to deliver consistently high-performance applications in JavaScript.

WebAssembly provides a way to run type-safe and high-performance applications in the JavaScript engine.

WebAssembly is blazingly fast

WebAssembly is the next great thing that happened in the web. It promises high and consistent performance with maintainable code, running native code and providing near-native performance on the web.

WebAssembly is type-safe

The JavaScript compiler struggles to provide high performance when you have polymorphic JavaScript code. WebAssembly, on the other hand, is type-safe (or monomorphic) at compile time. This not only boosts performance but also greatly reduces runtime errors, which is a win-win.

WebAssembly runs your native code

There have been multiple attempts to make the web faster by running native code. But they all failed because they are either vendor-specific or tied to a single language. The web is built on top of open standards. By being an open standard, WebAssembly makes it easy for all companies to adopt and support it. WebAssembly is not a language; it is a high-level implementation plan for other languages that compile to byte code that will run on the JavaScript engines.

WebAssembly is byte code

WebAssembly is nothing but a bytecode that runs in JavaScript Engine. In this book, we will learn how to convert native code into WebAssembly and how to optimize it to get even better performance. We will also cover how the entire WebAssembly runs on the JavaScript engine and how to use the various tools available and what they help us to achieve.

Most importantly, learn where and how to use WebAssembly to get the desired result out of it.

Let's make the web even more awesome and faster with WebAssembly.