What is WebAssembly?
WebAssembly or wasm is an experimental efficient low-level programming
language for in-browser client-side scripting, which is currently in
development. Its initial aim is to support C/C++, though other languages are
also intended to be supported. WebAssembly is a portable abstract syntax tree
which is designed to be faster to parse than JavaScript, as well as faster to
execute. The initial version of WebAssembly will be based on asm.js and PNaCl.
The team working on WebAssembly includes people from Mozilla, Google,
Microsoft, and Apple (who respectively control the four major browsers,
Firefox, Chrome, Internet Explorer, and Safari). In summary,WebAssembly is:
⌂ An
improvement to JavaScript: Implement your performance critical stuff in wasm
and import it like a standard JavaScript module.
⌂ A new
language: WebAssembly code defines an AST (so does JavaScript) represented in a
binary format. You can author and debug in a text format so it’s readable.
⌂ A browser
improvement: Browsers will understand the binary format, which means we’ll be
able to compile binary bundles that compress smaller than the text JavaScript
we use today. Smaller payloads mean faster delivery. Depending on compile-time
optimization opportunities, WebAssembly bundles may run faster than JavaScript.
⌂ A Compile
Target: A way for other languages to get first-class binary support across the
entire web platform stack.
Expect the contents of this repository to be in flux: everything is still
under discussion:
⌂ WebAssembly is efficient
and fast: The wasm AST is designed to be encoded in
a size- and load-time-efficient binary format. WebAssembly
aims to execute at native speed by taking advantage of common hardware capabilities available
on a wide range of platforms.
⌂ WebAssembly is safe:
WebAssembly describes a memory-safe, sandboxed execution environment that may
even be implemented inside existing JavaScript virtual machines. When embedded in the web,
WebAssembly will enforce the same-origin and permissions security policies of
the browser.
⌂ WebAssembly is open and
debuggable: WebAssembly is designed to be pretty-printed in a textual format for
debugging, testing, experimenting, optimizing, learning, teaching, and writing
programs by hand. The textual format will be used when viewing the source of wasm
modules on the web.
⌂ WebAssembly is part of
the open web platform: WebAssembly is designed to maintain the versionless,
feature-tested, and backwards-compatible nature of the web.
WebAssembly modules will be able to call into and out of the JavaScript context
and access browser functionality through the same Web APIs accessible from
JavaScript. WebAssembly also supports non-web embeddings.
References: