introduce
webAssembly
is a set of binary machine language that runs on the browser. It has the characteristics of being small and fast.
You can C
and C++
( emscirpten ), Typescript
( AssemblyScript ), Rust
( WASM-Pack ) to write webAssembly
.
webAssembly
can run directly in the browser environment, or in the node
environment.
timeline
- In 2015, the first release
webAssembly
implemented the game. Try the game - In 2017, it has been
Chrome, Edge, Firefox, and WebKit
Supported. see more - In 2019, the W3C made
webAssembly
theweb
standard. - Now, the support status of major browsers , the latest proposals
Features
- Running in a sandbox ensures environment isolation, so it can be used for virtual machine implementation.
- Efficient, portable, and works on multiple platforms.
scenes to be used
browser environment
- toolkits for some languages
- game
- Peer-to-peer applications such as blockchain
- Music APP
- image processing
- Remote Desktop
- encryption
- local web server
non-browser environment
- server application
- Server-side sandbox environment
-
hybird native app
WebAssembly key concepts
In javascript
of API
.
- Module : The compiled binary, ending with the
.wasm
suffix. - Memory :
ArrayBuffer
, variable size.WebAssembly
Requires manual memory management.WebAssembly
is to divide the memory according to the unit of "page", a "page" is 32B (often seeni32
is this size). - Table : A typed array of variable size.
Javascript
wraps an object with an array-like structure, storing multiple function references. - Instance : is an executable instance of
WebAssembly.Module
. The example contains allWebAssembly
export functions.
Read webAssembly
.
By converting the .wasm
file to .wat
. View grammar
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。