Created
April 21, 2018 10:25
-
-
Save tankala/fca53aa9f6334a91cd5cd92709596dc4 to your computer and use it in GitHub Desktop.
Cool way to measure execution time in Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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