Comcast / Comcast/Speed-testJS
JavaScript timing calculations could be more precise
- Dominant language
- JavaScript
- Stars
- 91
- Forks
- 51
- PR merge metrics
- No merged PRs in 30d
Description
All of the timing calculations appear to only leverage `Date.now()`... It would be better to use User Timing and/or Resource Timing if the user's browser supports it, or High Resolution Timing if neither is supported. Reason being is if a system clock adjustment happens to occur when doing the timing, the results will be inaccurate. Plus those other APIs provide sub-millisecond timing data.
Only if High Resolution timing is not supported should you fall back to `Date.now()`.
[Surf-N-Perf](http://comcast.github.io/Surf-N-Perf/) can help streamline that for you if you want to simplify your code, and that supports older browsers that don't support `Date.now()` as well.
Contributor guide
Assessment
This issue has not been assessed yet.