Skip to content

Instantly share code, notes, and snippets.

@asawilliams
Created July 27, 2012 16:16
Show Gist options
  • Save asawilliams/3188939 to your computer and use it in GitHub Desktop.
Save asawilliams/3188939 to your computer and use it in GitHub Desktop.
performance timer
var performance = {
map: {},
start: function(key) {
this.map[key] = {};
this.map[key].start = Date.now();
},
end: function(key) {
this.map[key].end = Date.now();
},
display: function(key) {
var time = (this.map[key].end - this.map[key].start)/1000 + ' seconds';
delete this.map[key];
return time;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment