tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

time_fetch.html (664B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4 <script>
      5 
      6  "use strict";
      7 
      8  async function time_fetch(url) {
      9    let start = performance.now();
     10    let res = await fetch(url);
     11    let elapsed = performance.now() - start;
     12 
     13    return {
     14      elapsed_ms : elapsed,
     15      status : res.status,
     16      data : await res.text()
     17    };
     18  }
     19 
     20  async function time_xhr(url) {
     21    let xhr = new XMLHttpRequest();
     22    xhr.open("GET", url, false);
     23    let start = performance.now();
     24    xhr.send();
     25    let elapsed = performance.now() - start;
     26 
     27    return {
     28      elapsed_ms : elapsed,
     29      status : xhr.status,
     30      data : xhr.responseText
     31    }
     32  }
     33 
     34 </script>
     35 </head>
     36 <body>
     37 </body>
     38 </html>