Skip to content

Instantly share code, notes, and snippets.

@robertklep
Created April 30, 2013 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertklep/5488842 to your computer and use it in GitHub Desktop.
Save robertklep/5488842 to your computer and use it in GitHub Desktop.
var fact = function(n) { if (n === 0) return 1; return n * fact(n - 1); };
var start = process.hrtime();
fact(150);
var diff = process.hrtime(start);
console.log('fact(150) took %d nanoseconds', diff[0] * 1e9 + diff[1]);
var child_process = require('child_process');
var start = process.hrtime();
child_process.exec('ls', function(err, stdout, stderr) {
// do nothing
});
var diff = process.hrtime(start);
console.log('exec took %d nanoseconds', diff[0] * 1e9 + diff[1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment