Created
December 9, 2014 19:48
-
-
Save eoftedal/25c3b33ed1a8c56f16f5 to your computer and use it in GitHub Desktop.
Performance logging in Chrome
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
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow @mikaelbr. That's awesome feedback! Thanks!