performance.now()
A function that returns a high-resolution timestamp in milliseconds, with fractions, for measuring how long something takes.
In more detail
Unlike Date.now() it never jumps when the system clock is adjusted, so it is the right tool for timing code. The value counts from when the program or page started, not from a calendar date.
Related terms
- DOMHighResTimeStamp — A time value in milliseconds with fractions, measured from when the page started loading, used by performance.now() and animation callbacks.
- Performance API — The browser interface for high-precision timing, which lets page code read measurements such as navigation phases, resource loads and custom marks.
- benchmark — A repeatable measurement of how long code takes, or how much it uses, under a fixed workload, or more broadly a standard point of comparison such as an industry average.
- timer drift — The growing gap between when a timer was asked to fire and when it actually fires, caused by a busy thread or scheduling delays.
Taught in
- requestAnimationFrame vs requestIdleCallback: High-FPS Work — Frontend Architecture & Web Platform
- Timers Phase: setTimeout, Min-Heap Scheduling & Drift — Node.js Internals & Backend Services