Skip to content

Instantly share code, notes, and snippets.

@RicoP
Created November 9, 2012 13:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RicoP/4045599 to your computer and use it in GitHub Desktop.
Save RicoP/4045599 to your computer and use it in GitHub Desktop.
JS performance timer
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