Skip to content

Instantly share code, notes, and snippets.

@ofrobots
Last active October 1, 2018 23:22
Show Gist options
  • Save ofrobots/f686aa7bc33b21e9c09bece53bb8bf52 to your computer and use it in GitHub Desktop.
Save ofrobots/f686aa7bc33b21e9c09bece53bb8bf52 to your computer and use it in GitHub Desktop.
const cp = require('child_process');
const INNER_LOOP = 50;
const OUTER_LOOP = 10;
function timeNodeStartup(times) {
const ts = Date.now();
for (let i = times; i > 0; --i) {
const result = cp.spawnSync(process.execPath, ["-e", "0"])
}
return Date.now() - ts;
}
const times = Array(OUTER_LOOP).fill(null).map(_ => timeNodeStartup(INNER_LOOP));
console.log(times);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment