【发布时间】:2015-08-28 00:26:25
【问题描述】:
performance.now() 和 Date.now() 有什么区别?
我是否应该考虑将performance.now() 替换为Date.now(),因为performace.now() 更加一致和独立?
【问题讨论】:
-
不!
Date.now()返回自 1970 年 1 月 1 日 00:00:00 UTC 以来经过的毫秒数,performance.now()返回自任意纪元以来经过的毫秒/微秒数。基本上,performance.now()应该只在你想测量两个时间点之间的相对距离时使用,而不是它们的“绝对”时间位置。 -
@buttifulbuttefly 所说的,加上 ...
performance.now提供更精确的计时(亚毫秒精度)。 -
确实,更精确的时间,而不是更精确的时间。
-
@markE 这不再是真的了。由于Spectre,
performance.nowis being limited的精度
标签: javascript time