Performance.now() method returns a
DOMHighResTimeStamp, measured in milliseconds, accurate to one thousandth of a millisecond equal to the number of milliseconds since the
PerformanceTiming.navigationStart property and the call to the method.
t = performance.now();
var t0 = performance.now(); doSomething(); var t1 = performance.now(); console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.")
Date.now), the timestamps returned by
Performance.now() are not limited to one-millisecond resolution. Instead, they represent times as floating-point numbers with up to microsecond precision.
Date.now, the values returned by
Performance.now() always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like NTP).
|High Resolution Time||Recommendation||Initial definition|
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Basic support||20.0 webkit
|15.0 (15.0)||10.0||15.0||Not supported|
|Feature||Android||Chrome for Android||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Safari Mobile|
|Basic support||4.0||(Yes)||15.0 (15.0)||10.0||Not supported||Not supported|
NOTE: *Windows version of Chrome 20 through 33, at the time of this writing, returns performance.now() only to millisecond precision.
- When milliseconds are not enough: performance.now() from HTML5 Rocks.