Comcast / Comcast/Speed-testJS

JavaScript timing calculations could be more precise

Open
#106 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.