performance.now

q6hillz·2022년 4월 17일
0

javascript

목록 보기
28/60
post-custom-banner

performance.now()

The returned value represents the time elapsed since the time origin.

Example

const t0 = performance.now();
doSomething();
const t1 = performance.now();
console.log(`Call to doSomething took ${t1 - t0} milliseconds.`);

Copy to Clipboard

Unlike other timing data available to JavaScript (for example 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.

Also unlike 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). Otherwise, performance.timing.navigationStart + performance.now() will be approximately equal to Date.now().

performance.now() => system clock에 의해서 측정되는 timestamp 수치 (microsecond precision).

post-custom-banner

0개의 댓글