Skip to content

Instantly share code, notes, and snippets.

@eoftedal
Created December 9, 2014 19:48
Show Gist options
  • Save eoftedal/25c3b33ed1a8c56f16f5 to your computer and use it in GitHub Desktop.
Save eoftedal/25c3b33ed1a8c56f16f5 to your computer and use it in GitHub Desktop.
Performance logging in Chrome
function perfLog(fun, context) {
var context = context || this;
var realFun = context[fun.name];
context[fun.name] = function() {
console.time(fun.name);
var result = realFun.apply(context, arguments);
console.timeEnd(fun.name);
return result;
}
}
//How to use
perfLog(eval);
perfLog(document.body.appendChild, document.body);
@eoftedal
Copy link
Author

eoftedal commented Dec 9, 2014

Wow @mikaelbr. That's awesome feedback! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment