Minor improvement to jitter measurement
This commit is contained in:
parent
b9498fe34b
commit
6028d58951
|
@ -457,7 +457,9 @@ function pingTest (done) {
|
||||||
var instjitter = Math.abs(instspd - prevInstspd)
|
var instjitter = Math.abs(instspd - prevInstspd)
|
||||||
if (i === 1) ping = instspd; /* first ping, can't tell jitter yet*/ else {
|
if (i === 1) ping = instspd; /* first ping, can't tell jitter yet*/ else {
|
||||||
ping = instspd < ping ? instspd : ping * 0.8 + instspd * 0.2 // update ping, weighted average. if the instant ping is lower than the current average, it is set to that value instead of averaging
|
ping = instspd < ping ? instspd : ping * 0.8 + instspd * 0.2 // update ping, weighted average. if the instant ping is lower than the current average, it is set to that value instead of averaging
|
||||||
jitter = instjitter > jitter ? (jitter * 0.3 + instjitter * 0.7) : (jitter * 0.8 + instjitter * 0.2) // update jitter, weighted average. spikes in ping values are given more weight.
|
if(i === 2) jitter=instjitter //discard the first jitter measurement because it might be much higher than it should be
|
||||||
|
else
|
||||||
|
jitter = instjitter > jitter ? (jitter * 0.3 + instjitter * 0.7) : (jitter * 0.8 + instjitter * 0.2) // update jitter, weighted average. spikes in ping values are given more weight.
|
||||||
}
|
}
|
||||||
prevInstspd = instspd
|
prevInstspd = instspd
|
||||||
}
|
}
|
||||||
|
|
2
Frontend/speedtest_worker.min.js
vendored
2
Frontend/speedtest_worker.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue