Skip to content

Instantly share code, notes, and snippets.

@tankala
Created April 21, 2018 10:25
Show Gist options
  • Save tankala/fca53aa9f6334a91cd5cd92709596dc4 to your computer and use it in GitHub Desktop.
Save tankala/fca53aa9f6334a91cd5cd92709596dc4 to your computer and use it in GitHub Desktop.
Cool way to measure execution time in Node.js
var sleepFunction = function(milliSecondsToSleep, timerLabel) {
console.time(timerLabel);
setTimeout(function() {
console.timeEnd(timerLabel);
}, milliSecondsToSleep);
}
console.time("Program");
sleepFunction(1000, "FunctionCall1");
sleepFunction(1000, "FunctionCall2");
console.timeEnd("Program");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment