Last active
December 29, 2015 23:59
-
-
Save fson/7746937 to your computer and use it in GitHub Desktop.
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
function timeit(fn) { | |
console.time(fn.name); | |
fn.apply(null, [].slice.call(arguments, 1).map(function (arg) { | |
if (arg === timeit.done) return function () { console.timeEnd(fn.name); } | |
else return arg; | |
})); | |
} | |
timeit.done = function () {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To time the function call
just call