3 ms·
Why high precision timing was ever introduced into browsers is beyond me. I don't see why timers should be more accurate that millisecond precision or why the t
by xigency 9y ago
Why high precision timing was ever introduced into browsers is beyond me. I don't see why timers should be more accurate that millisecond precision or why the timer should return different values when polled more than once in the same execution context (as an event based language).
Edit:
> 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.
What a terrible idea. If this kind of profiling is needed, it should be better off as a feature of the browser developer tools, not a built-in function.
None of these examples are compelling to me either: https://w3c.github.io/hr-time/#introduction https://w3c.github.io/hr-time/#introduction
HTML 5 audio has its own standards as does drawing. In fact, a high-precision timer is the worst solution to any of those problems.
- mistercow 9y agoI would say that ideally, you have a dev tool feature to make the function available, and just have a stub by default that returns a constant or a low resolution timestamp. That way, you can still do whatever kind of custom instrumentation you want, but it's not sitting there waiting to be exploited in an end-user's browser.
- niftich 9y agoIt was introduced because "web developers are building more sophisticated applications where application performance is increasingly important. Developers need the ability to assess and understand the performance characteristics of their applications using well-defined interoperable measures." [1]. Browser-engine makers, like WebKit, were itching [2] to implement this, so they participated early on. The proceedings of this W3C working group were conducted in the open; their mailing list archive is public [3]. For a cute and oblivious early message, see this post [4] from July 2010. Luckily it was eventually followed up by the first wave of enumerated privacy concerns [5] in October 2010. [1] https://lists.w3.org/Archives/Public/public-web-perf/2010Jun/att-0002/webperf.html https://lists.w3.org/Archives/Public/public-web-perf/2010Jun... [2] https://lists.w3.org/Archives/Public/public-web-perf/2010Jul/0012.html https://lists.w3.org/Archives/Public/public-web-perf/2010Jul... [3] https://lists.w3.org/Archives/Public/public-web-perf/ https://lists.w3.org/Archives/Public/public-web-perf/ [4] https://lists.w3.org/Archives/Public/public-web-perf/2010Jul/0009.html https://lists.w3.org/Archives/Public/public-web-perf/2010Jul... [5] https://lists.w3.org/Archives/Public/public-web-perf/2010Oct/0027.html https://lists.w3.org/Archives/Public/public-web-perf/2010Oct...