An AssemblyScript example. This is actually a benchmark - visualizing it just so happened.
First, install the development dependencies:
$> npm install
Now, to build assembly/index.ts to an untouched and an optimized .wasm including their respective .wat representations, run:
$> npm run asbuild
Afterwards, run
$> npm start
to start a local server.
To run the benchmark:
$> npm test [steps=1000000]
Environment:
- MacBook Pro (15-inch, 2019)
- macOS 10.15.3
- node.js v13.8.0
- rustc 1.42.0-nightly (3a3f4a7cb 2019-12-28)
Results:
| Target | Time, ms | Size, KB |
|---|---|---|
| AssemblyScript WASM | 1602 | 1.6 |
| AssemblyScript ASMJS | 2368 | 10* |
| JavaScript | 1616 | 5* |
| Rust WASM | 1618 | 2 |
* unminified