mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-05-19 10:41:29 +00:00
48 lines
1.2 KiB
Markdown
48 lines
1.2 KiB
Markdown
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)
|
|
- macOS 10.14.3
|
|
- node.js v11.9.0
|
|
- rustc 1.33.0-nightly (ceb251214 2019-01-16)
|
|
|
|
***Results:***
|
|
|
|
| Target | Time, ***ms*** | Size, ***KB*** |
|
|
|-------------------------|-----------------|----------------|
|
|
| **AssemblyScript WASM** | **2901** | **2** |
|
|
| AssemblyScript ASMJS | 3720 | 19* |
|
|
| JavaScript | 2716 | 5* |
|
|
| Rust WASM | 2883 | 13 |
|
|
|
|
___* unminified___
|