WebAssembly的官方介绍:
WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications.
WebAssembly: What Is It And Why Should You Care?
- 弥补JavaScript的性能不足
- 支持非浏览器的场景
- 促进Web平台的硬件支持
- 运行在与JavaScript相同的沙箱中,具有相同的安全限制
wat格式有点类似汇编语言。wasm格式则是wat编译成的二进制格式。最大的好处是可以移植其他语言编写的代码到web上执行。
asm.js与Wasm有类似的目标,但是编译后的代码对标的是JavaScript。
emscripten可以将C/C++编译成wasm,使其在Web可用。
文中举了一个例子的。
Figma的故事:https://www.figma.com/blog/webassembly-cut-figmas-load-time-by-3x/
Microsoft gets serious about WebAssembly
写得不错。
其他
- World Wide Web Consortium (W3C) brings a new language to the Web as WebAssembly becomes a W3C Recommendation
- Using WebAssembly threads from C, C++ and Rust
- Can C++ be called from C# compiled to wasm?
2021-08-08更新
WebAssembly Concepts
Using the WebAssembly JavaScript API
(更新完)