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 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.
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 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.