Skip to content

Commit

Permalink
Improved ping/jitter test
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfintel committed Jun 14, 2017
1 parent 710887f commit 23b188b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions doc.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HTML5 Speedtest

> by Federico Dossena
> Version 4.2.2, June 13 2017
> Version 4.2.3, June 14 2017
> [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/)

Expand Down Expand Up @@ -206,7 +206,7 @@ It is important here to turn off compression, and generate incompressible data.
A symlink to `/dev/urandom` is also ok.

#### Replacement for `empty.php`
Your replacement must simply respond with a HTTP code 200 and send nothing else. You may want to send additional headers to disable caching.
Your replacement must simply respond with a HTTP code 200 and send nothing else. You may want to send additional headers to disable caching. The test assumes that Connection:keep-alive is sent by the server.

#### Replacement for `getIP.php`
Your replacement must simply respond with the client's IP as plaintext. Nothing fancy.
Expand All @@ -220,6 +220,7 @@ w.postMessage('start {"url_dl": "newGarbageURL", "url_ul": "newEmptyURL", "url_p


## Known bugs and limitations
* The ping/jitter test is measured by seeing how long it takes for an empty XHR to complete. It is not an acutal ICMP ping
* __Chrome:__ high CPU usage from XHR requests with very fast connections (like gigabit).
For this reason, the test may report inaccurate results if your CPU is too slow. (Does not affect most computers)
* __IE11:__ the upload test is not precise on very fast connections
Expand Down
1 change: 1 addition & 0 deletions empty.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Connection: keep-alive");
?>
4 changes: 2 additions & 2 deletions speedtest_worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
HTML5 Speedtest v4.2.2
HTML5 Speedtest v4.2.3
by Federico Dossena
https://github.com/adolfintel/speedtest/
GNU LGPLv3 License
Expand Down Expand Up @@ -325,7 +325,7 @@ function pingTest (done) {
if (i === 0) {
prevT = new Date().getTime() // first pong
} else {
var instspd = (new Date().getTime() - prevT) / 2
var instspd = (new Date().getTime() - prevT)
var instjitter = Math.abs(instspd - prevInstspd)
if (i === 1) ping = instspd; /* first ping, can't tell jiutter yet*/ else {
ping = ping * 0.9 + instspd * 0.1 // ping, weighted average
Expand Down
2 changes: 1 addition & 1 deletion speedtest_worker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 23b188b

Please sign in to comment.