diff --git a/examples/n-body/README.md b/examples/n-body/README.md index b92a99b7..257b4a20 100644 --- a/examples/n-body/README.md +++ b/examples/n-body/README.md @@ -31,17 +31,17 @@ 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) +- 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** | **3167** | **2** | -| AssemblyScript ASMJS | 3633 | 21* | -| JavaScript | 2628 | 5* | -| Rust WASM | 3876 | 13 | +| **AssemblyScript WASM** | **2901** | **2** | +| AssemblyScript ASMJS | 3720 | 19* | +| JavaScript | 2716 | 5* | +| Rust WASM | 2883 | 13 | ___* unminified___ diff --git a/examples/n-body/package.json b/examples/n-body/package.json index f1d93e48..ce64e03a 100644 --- a/examples/n-body/package.json +++ b/examples/n-body/package.json @@ -10,7 +10,7 @@ "tsbuild": "tsc -p assembly -t ES2017 -m commonjs --outDir build", "build": "npm run asbuild && npm run tsbuild", "server": "http-server . -o -c-1", - "test": "node tests" + "test": "node --noliftoff --nowasm-tier-up --wasm-lazy-compilation --wasm-no-bounds-checks --expose-gc tests" }, "devDependencies": { "http-server": "^0.11.1", diff --git a/examples/n-body/tests/index.js b/examples/n-body/tests/index.js index 43170966..8d6c4705 100644 --- a/examples/n-body/tests/index.js +++ b/examples/n-body/tests/index.js @@ -34,11 +34,25 @@ const nbodyJS = new Function( ...Object.keys(scopeJS).concat(src + "\nreturn exports"))(...Object.values(scopeJS) ); +function gcCollect() { + if (global.gc) { + global.gc(); + global.gc(); + } +} + +function sleep(delay) { + var start = Date.now(); + while (Date.now() < start + delay); +} + function test(nbody, steps) { nbody.init(); var start = process.hrtime(); nbody.bench(steps); - return process.hrtime(start); + let t = process.hrtime(start); + gcCollect(); + return t; } var steps = process.argv.length > 2 ? parseInt(process.argv[2], 10) : 20000000; @@ -66,6 +80,7 @@ prologue("Rust WASM", steps); epilogue(test(nbodyRS, steps)); console.log("\nWARMED UP SERIES:\n"); +sleep(1000); prologue("AssemblyScript WASM", steps); epilogue(test(nbodyAS, steps));