50 lines
1.2 KiB
Markdown
Raw Normal View History

2018-07-22 02:55:46 +02:00
N-body system
=============
An [AssemblyScript](http://assemblyscript.org) 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](./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 <a href="http://localhost:9080">local server</a>. Should also automatically launch a browser.
To run the benchmark:
```
$> npm run test [steps=1000000]
```
Benchmark
=========
***Environment:***
- MacBook Pro (Retina, 15-inch, Late 2013)
2019-02-21 03:14:35 +02:00
- macOS 10.14.3
2019-03-06 22:27:54 +02:00
- node.js v11.10.1
- rustc 1.35.0-nightly (a9da8fc9c 2019-03-04)
***Results:***
| Target | Time, ***ms*** | Size, ***KB*** |
|-------------------------|-----------------|----------------|
2019-03-06 22:27:54 +02:00
| **AssemblyScript WASM** | **2921** | **2** |
| AssemblyScript ASMJS | 3807 | 19* |
| JavaScript | 2757 | 5* |
| Rust WASM | 2866 | 20 / 2** |
___* unminified___
2019-03-06 22:27:54 +02:00
___** after wasm-gc___