Permalink
Browse files

Minor improvement to ping test; Bumped version to 4.6.2

  • Loading branch information...
adolfintel committed Sep 20, 2018
1 parent 52e91f9 commit b509c832e222ad108086a400a1ad7662efec6351
Showing with 8 additions and 8 deletions.
  1. +3 −3 doc.md
  2. +4 −4 speedtest_worker.js
  3. +1 −1 speedtest_worker.min.js
View
6 doc.md
@@ -1,7 +1,7 @@
# HTML5 Speedtest
> by Federico Dossena
> Version 4.6.1, August 8, 2018
> Version 4.6.2, September 21, 2018
> [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/)
@@ -180,8 +180,8 @@ w.postMessage('start '+JSON.stringify(params))
* Default: `15`
* Recommended: `>=10`
* __count_ping__: How many pings to perform in the ping test
* Default: `35`
* Recommended: `>=20`
* Default: `10`
* Recommended: `>=3, <30`
* __url_dl__: path to garbage.php or a large file to use for the download test.
* Default: `garbage.php`
* __Important:__ path is relative to js file
View
@@ -1,5 +1,5 @@
/*
HTML5 Speedtest v4.6.1
HTML5 Speedtest v4.6.2
by Federico Dossena
https://github.com/adolfintel/speedtest/
GNU LGPLv3 License
@@ -28,7 +28,7 @@ var settings = {
time_dl: 15, // duration of download test in seconds
time_ulGraceTime: 3, //time to wait in seconds before actually measuring ul speed (wait for buffers to fill)
time_dlGraceTime: 1.5, //time to wait in seconds before actually measuring dl speed (wait for TCP window to increase)
count_ping: 35, // number of pings to perform in ping test
count_ping: 10, // number of pings to perform in ping test
url_dl: 'garbage.php', // path to a large file or garbage.php, used for download test. must be relative to this js file
url_ul: 'empty.php', // path to an empty file, used for upload test. must be relative to this js file
url_ping: 'empty.php', // path to an empty file, used for ping test. must be relative to this js file
@@ -442,8 +442,8 @@ function pingTest (done) {
}
var instjitter = Math.abs(instspd - prevInstspd)
if (i === 1) ping = instspd; /* first ping, can't tell jitter yet*/ else {
ping = ping * 0.9 + instspd * 0.1 // ping, weighted average
jitter = instjitter > jitter ? (jitter * 0.2 + instjitter * 0.8) : (jitter * 0.9 + instjitter * 0.1) // update jitter, weighted average. spikes in ping values are given more weight.
ping = instspd < ping ? ping : 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.
}
prevInstspd = instspd
}
Oops, something went wrong.

0 comments on commit b509c83

Please sign in to comment.