Skip to content

Instantly share code, notes, and snippets.

@catdad
Created October 7, 2015 19:34
Show Gist options
  • Select an option

  • Save catdad/2c18073afc5869dd77a3 to your computer and use it in GitHub Desktop.

Select an option

Save catdad/2c18073afc5869dd77a3 to your computer and use it in GitHub Desktop.
var start = process.hrtime();
// do work here
var diff = process.hrtime(start);
var nano = diff[0] * 1e9 + diff[1];
console.log('benchmark took %d nanoseconds', nano);
console.log('benchmark took %d milliseconds', nano * 1e-6);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment