Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Colin Eberhardt

Rating No ratings yet

While it may be hard to believe, WebAssembly is the very first new and universally supported language and browser runtime since the introduction of JavaScript 25 years ago. And just like its predecessor, this young technology holds a lot of promise. Colin Eberhardt shares everything you need to get started with WebAssembly--including history and context, an introduction to modules, execution, runtime, and practical instructions for using it. He'll also take a look at what the future might hold, from serving as a runtime for blockchain (or standing on its own in that right) to serverless computing uses and much more. Delve into the beginnings of JavaScript and discover how WebAssembly differs Learn why WebAssembly matters and how to use it Find out how others have successfully applied this technology Explore WebAssembly in practice, including computer aided design, PDF rendering, 3D visualization, and more See what's ahead in terms of features and uses beyond the browser

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A concise, historically grounded introduction to WebAssembly: what it is, why JavaScript's limits made it necessary, how modules and runtimes work, and where the technology is heading. Best for web developers, systems-minded programmers, and technical leads evaluating whether Wasm belongs in their stack. 【Book Arc】 - **Opening (~0%–10%)**: Frames the core question—why a new web runtime was needed after 25 years of JavaScript dominance—by tracing JavaScript's rapid creation, its quirks, and the plug-in era (Flash, Silverlight) that ended with the smartphone shift. - **Early (~10%–30%)**: Explains the performance problem in JavaScript execution (interpreters vs. compilers, tiered optimization, download/parse bottlenecks) and introduces asm.js as the precursor that proved a faster embedded runtime was possible; then covers WebAssembly's 2015 working-group formation and rapid browser support. - **Early–Middle (~25%–40%)**: Walks through the static structure of a Wasm module using a small C-to-Wasm example—binary `.wasm` format, textual `.wat` representation, sections, exports, the four numeric types, and linear memory—before turning to execution and the host runtime. - **Middle (~38%–55%)**: Covers host interoperability (exports, imports, shared linear memory, glue code), security (sandboxing, same-origin policy, no built-in I/O), portability, and performance characteristics, including why Wasm reaches peak speed faster than JavaScript. - **Late (~55%+)**: Moves into practical tooling and real-world use cases—CAD, PDF rendering, 3D visualization, image/video editing, games, AR/VR—and looks ahead to non-browser uses such as blockchain runtimes and serverless computing. (Excerpts do not cover the full detail of later chapters.) 【Key Takeaways】 - **WebAssembly exists because JavaScript has structural performance limits** (Opening): the book traces how JavaScript's dynamic nature, HTTP delivery, and parse/compile overhead create a bottleneck that Wasm's compact binary format and fast decoding address. - **asm.js was the crucial stepping stone** (Early): Mozilla's Emscripten and asm.js proved that a more efficient runtime could live inside the JavaScript VM, directly shaping WebAssembly's design. - **Wasm modules are compact, sectioned binaries with a readable textual form** (Early): understanding `.wasm` vs. `.wat`, exports, code sections, and the four numeric types is foundational to grasping both capabilities and constraints. - **Linear memory is the key to complex data exchange** (Middle): since Wasm's type system is numeric-only, strings, arrays, and structs live in linear memory and require glue code for the host to decode them. - **Wasm is not a JavaScript replacement** (Early–Middle): it was designed for close cooperation with JavaScript, loaded via fetch APIs and instantiated through JavaScript, with synchronous call boundaries between the two. - **Security is built into the runtime model** (Middle): sandboxing, same-origin policy, and the absence of built-in I/O mean modules can only interact with the host through imports and exports. - **Wasm targets computationally intensive workloads, not typical websites** (Middle): CAD, games, video editing, AR/VR, and scientific simulation are natural fits; social media, news portals, and form-based CRMs are explicitly not the target. - **Portability beyond the browser is a core design goal** (Middle–Late): the binary format was built for multiple OSes and instruction sets, enabling integration into a wide range of non-browser runtimes. 【Reading Tips】 - **Deep-read the module structure and linear memory sections** (roughly 25%–40%): these are the conceptual backbone; skimming them makes later discussions of tooling and limitations harder to follow. - **Skim the JavaScript history if you already know it**, but don't skip the asm.js discussion—it explains why Wasm looks the way it does. - **Pay attention to the "not a use case" list**: it's a practical filter for deciding whether Wasm is appropriate for your project. - **Treat the tooling example as a walkthrough, not a reference**: the C-to-Wasm compilation via Emscripten is illustrative; the book explicitly avoids deep instruction-set detail. - **Read the future-looking material as directional, not definitive**: the book is from 2020, so blockchain and serverless predictions should be checked against current developments. 【Coverage Limits】 This guide is based on stratified excerpts covering roughly the first half of the book in detail, with later chapters on practical applications and future directions represented only by summary-level material. Specific chapter titles, benchmarks, and later-case-study details are not fully covered in the excerpts.
Excerpt 1
eilly logo is a registered trademark of O’Reilly Media, Inc. What Is WebAssembly? , the cover image, and related trade dress are trademarks of O’Reilly Media...
View in text
Excerpt 2
h type information retained through various hints . The asm.js subset was carefully crafted to remove the dynamic behavior of JavaScript and remove memory al...
View in text
Excerpt 3
mediate function state is stored. Instructions (such as i32.add ) pop values from the stack and push their return value back onto it. The second is global va...
View in text
Excerpt 4
odule can interoperate with its host is via exports/imports. Portability WebAssembly’s binary format was designed to be efficiently executed on a variety of...
View in text
Excerpt 5
an official ASP.NET project, with an “experimental” status. The project has matured quite rapidly, with Microsoft recently announcing that its first full pro...
View in text
Excerpt 6
is also exploring WebAssembly in a number of other projects. The company is using it within its note-taking app, Google Keep, which has a WebAssembly module...
View in text
Excerpt 7
red access to linear memory and providing atomic operations. Notably, this proposal does not introduce a mechanism for creating threads; instead, this functi...
View in text
Excerpt 8
ications on the web, using a range of programming languages. It was anticipated that people would use WebAssembly for video editing, CAD, Augmented Reality (...
View in text
Tags
AI categories
Web TechnologyProgramming LanguageSoftware
ISBN: 1492076902
Publish Year: 2019
Language: English
Pages: 47
File Format: EPUB
File Size: 1.5 MB