Skip to content

Instantly share code, notes, and snippets.

@RicoP
Created November 9, 2012 13:11
Show Gist options
  • 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