Created
November 9, 2012 13:11
-
-
Save RicoP/4045599 to your computer and use it in GitHub Desktop.
JS performance timer
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
var perfnow = (function() { | |
return ( | |
(performance && performance.now) ? function() { return performance.now(); } | |
: (performance && performance.webkitNow) ? function() { return performance.webkitNow(); } | |
: (performance && performance.mozNow) ? function() { return performance.mozNow(); } | |
: (performance && performance.oNow) ? function() { return performance.oNow(); } | |
: (Date.now) ? function() { return Date.now(); } | |
: function() { return +new Date(); } | |
) | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://updates.html5rocks.com/2012/08/When-milliseconds-are-not-enough-performance-now