Last active
November 15, 2017 09:55
-
-
Save kaerer/bbcea44a5b38b93732166804a70e0069 to your computer and use it in GitHub Desktop.
JsBenchmark
This file contains 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 timer = function(name) { | |
var start = new Date(); | |
return { | |
stop: function() { | |
var end = new Date(); | |
var time = end.getTime() - start.getTime(); | |
console.log('Timer:', name, 'finished in', time, 'ms'); | |
} | |
} | |
}; | |
var t = timer('A'); | |
// code | |
t.stop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment