Add ol' N-body benchmark to examples fwiw

This commit is contained in:
dcodeIO
2018-04-23 02:43:03 +02:00
parent 2ff1bb745a
commit 80d104201c
11 changed files with 10148 additions and 0 deletions

View 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 + ")");