mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-24 12:11:50 +00:00
Add ol' N-body benchmark to examples fwiw
This commit is contained in:
10
examples/n-body/tests/index.js
Normal file
10
examples/n-body/tests/index.js
Normal file
@ -0,0 +1,10 @@
|
||||
var nbody = require("..");
|
||||
|
||||
var steps = process.argv.length > 2 ? parseInt(process.argv[2], 10) : 1000000;
|
||||
console.log("Performing " + steps + " steps ...");
|
||||
|
||||
var start = process.hrtime();
|
||||
var energy = nbody.bench(steps);
|
||||
var time = process.hrtime(start);
|
||||
|
||||
console.log("Took " + (time[0] * 1e3 + time[1] / 1e6) + "ms (energy=" + energy + ")");
|
Reference in New Issue
Block a user