Speed-Test icon indicating copy to clipboard operation
Speed-Test copied to clipboard

Feature Request: Ping Result with Decimal Place (sub milliseconds)

Open zR-JB opened this issue 1 year ago • 11 comments

Or is this not possible because of the accuracy of: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now

used in https://github.com/openspeedtest/Docker-Image/blob/main/files/www/assets/js/app-2.5.4.js#L1319 ? ?

zR-JB avatar Jul 26 '24 09:07 zR-JB

Maybe it is possible, they claim sub millisecond accuracy: https://developer.mozilla.org/en-US/docs/Web/API/Performance_API/High_precision_timing

zR-JB avatar Jul 26 '24 09:07 zR-JB

What is the reason, that Math.floor() ist used there ?

zR-JB avatar Jul 26 '24 09:07 zR-JB

@zR-JB Check https://github.com/openspeedtest/Docker-Image/blob/main/files/www/assets/js/app-2.5.4.js#L1337C13-L1340C21 I did that because of Safari. Safari will return zero if we go for sub-millisecond accuracy.

openspeedtest avatar Jul 26 '24 09:07 openspeedtest

How much work would an extra flag be, to enable this for the users that want it ?

zR-JB avatar Jul 26 '24 09:07 zR-JB

@zR-JB It's easy. If necessary, I can add a flag in the next version, and I am planning to do that in the coming weeks. But who cares about sub-millisecond accuracy? What is the real-world application?

openspeedtest avatar Jul 26 '24 09:07 openspeedtest

Many use openspeedtest inside their home network.

For me e.g. I always get 1ms reading at home, but 0,5 ms and 1,95 is a huge difference when debugging Wi-Fi or even LAN.

And with my new Fiber line I also get sub-millisecond latency to some other public services, so at least the first decimal place matters. I think 0,2 ms latency to the first hop is pretty much standard nowadays.

Or let's say I introduce a new Router or Layer 3 Switch inside my home network (between two subnets or so) and want to measure the impact on real world latency.

zR-JB avatar Jul 26 '24 09:07 zR-JB

@zR-JB Thank you for pointing out this issue. I will address it very soon.

openspeedtest avatar Jul 26 '24 09:07 openspeedtest

According to Mozilla You will not get precision better than 1 ms in Firefox anyway... Chrome and Edge seem to give 0.1ms precision ping results.

Weegley avatar Aug 10 '24 01:08 Weegley

According to Mozilla You will not get precision better than 1 ms in Firefox anyway... Chrome and Edge seem to give 0.1ms precision ping results.

Yeah, I did some further testing and got 0.1ms accuracy only with chromium based browsers!

zR-JB avatar Aug 10 '24 05:08 zR-JB

@zR-JB Yes FF Array(9) [ 1, 0, 1, 0, 0, 1, 0, 0, 1 ]

Chrome (9) [1.5, 1, 0.5999999940395355, 0.3999999910593033, 0.3999999910593033, 0.6000000089406967, 0.9000000059604645, 0.5999999940395355, 0.5999999940395355]

Safari [0.9999999999999858, 1, 1, 1, 0.9999999999999858, 1, 1, 1, 1] (9)

I think it's better to report what the browser returns, but you'll see 0 on Firefox and 0.1 on Chrome and Safari.

vishnunuk avatar Aug 11 '24 06:08 vishnunuk

Yes would say so, too. If the flag is set, report the raw browser response. Maybe in the future something changes with the browser's too, so who knows. Might be even more helpful in the future!

zR-JB avatar Aug 11 '24 07:08 zR-JB