Daniel Wirtz 0c64f21250
Rework resolver (#489)
* Rework IR and resolver to use nested lookup tables
* Integrate types into IR
* Make components prefer IR, slimmed down AST
* Implement `export *`
* Add `@lazy` annotation and remove `--noTreeShaking`
* Add `@start` annotation and remove magic `main`
* Related refactoring, cleanup and docs
2019-02-21 00:11:22 +01:00
..
2018-07-22 02:55:46 +02:00
2019-02-21 00:11:22 +01:00
2018-10-26 18:25:09 +02:00
2018-07-22 02:55:46 +02:00
2018-10-26 18:25:09 +02:00

N-body system

An AssemblyScript example. This is actually a benchmark - visualizing it just so happened.

Instructions

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 run server to start a local server. Should also automatically launch a browser.

To run the benchmark:

$> npm run test [steps=1000000]

Benchmark

Environment:

  • MacBook Pro (Retina, 15-inch, Late 2013)
  • macOS 10.14
  • node.js v10.11.0
  • rustc 1.31.0-nightly (4bd4e4130 2018-10-25)

Results:

Target Time, ms Size, KB
AssemblyScript WASM 3167 2
AssemblyScript ASMJS 3633 21*
JavaScript 2628 5*
Rust WASM 3876 13

* unminified