Skip to content

Instantly share code, notes, and snippets.

@kaerer
Last active November 15, 2017 09:55
Show Gist options
  • Save kaerer/bbcea44a5b38b93732166804a70e0069 to your computer and use it in GitHub Desktop.
Save kaerer/bbcea44a5b38b93732166804a70e0069 to your computer and use it in GitHub Desktop.
JsBenchmark
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