measuring download speed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D. Alvarado

    #1

    measuring download speed

    Hello, I would like to design a page that measures the user's download
    connection. Does anyone have an example link or script that might aid
    me in this task?

    Thanks, - Dave
  • Randy Webb

    #2
    Re: measuring download speed

    D. Alvarado wrote:
    [color=blue]
    > Hello, I would like to design a page that measures the user's download
    > connection. Does anyone have an example link or script that might aid
    > me in this task?[/color]

    You can't reliably detect the download speed as too many other things
    can alter its results. Search the c.l.j archives on groups.google.c om
    for "determine download speed" and you can read the past discussions on it.
    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: measuring download speed

      D. Alvarado wrote:[color=blue]
      > Hello, I would like to design a page that measures the user's download
      > connection. Does anyone have an example link or script that might aid
      > me in this task?[/color]

      I do not have a link but this is not a hard one. All you need to know
      is the size of the downloaded test data. Then you compute the number of
      milliseconds passed between start and end of download and divide the
      size by this value, getting the download speed in bytes/s, for example.
      However, note that the real download speed may vary very much.

      The test data could be the document itself where the client-side script
      is included:

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd">
      <html>
      <head>
      ...
      <script type="text/javascript">
      var start = new Date();
      </script>
      ...
      </head>

      <body>
      ...
      <script type="text/javascript">
      var msPassed = new Date().getTime( ) - start.getTime() ;
      var bytesPerMS = Math.round(byte Size / msPassed);
      </script>
      </body>
      </html>

      In IE, the value of byteSize can be obtained with
      document.docume ntElement.outer HTML.length.

      Or it could be a multimedia resource which size you know and which you
      embed in a test document. With client-side J(ava)Script you could then
      "start the timer" before it is loaded and "stop it" if it is loaded.


      HTH

      PointedEars

      Comment

      • Randy Webb

        #4
        Re: measuring download speed

        Thomas 'PointedEars' Lahn wrote:[color=blue]
        > D. Alvarado wrote:
        >[color=green]
        >>Hello, I would like to design a page that measures the user's download
        >>connection. Does anyone have an example link or script that might aid
        >>me in this task?[/color]
        >
        >
        > I do not have a link but this is not a hard one. All you need to know
        > is the size of the downloaded test data. Then you compute the number of
        > milliseconds passed between start and end of download and divide the
        > size by this value, getting the download speed in bytes/s, for example.
        > However, note that the real download speed may vary very much.[/color]

        And that "variation" is what makes your test useless. If I am
        multi-tasking with a broadband connection, with 17 other applications
        running, with low resources, and then reboot and try it again, then you
        will get different results.

        So, let me restate what has been said on many many occasions before now,
        you can *not* _reliably_ determine the connection speed, you can only
        try to *guess* the download speed at that particular time, and then its
        still worthless.

        Besides, coming from someone who preaches the "non-javascript" side of
        scripting, your "solution" is definitely broken when script is disabled.



        --
        Randy
        Chance Favors The Prepared Mind
        comp.lang.javas cript FAQ - http://jibbering.com/faq/

        Comment

        • Dr John Stockton

          #5
          Re: measuring download speed

          JRS: In article <9fe1f2ad.04061 41305.7a525c41@ posting.google. com>, seen
          in news:comp.lang. javascript, D. Alvarado <laredotornado@ zipmail.com>
          posted at Mon, 14 Jun 2004 14:05:54 :
          [color=blue]
          >Hello, I would like to design a page that measures the user's download
          >connection. Does anyone have an example link or script that might aid
          >me in this task?[/color]

          <URL:http://www.merlyn.demo n.co.uk/js-date1.htm> measures, if the
          receiving computer is not distracted, the time taken to transfer the
          majority of the page, and shows it at the end.

          In the absence of cache effects, this gives a rough estimate of the
          current download speed; not an entirely trustworthy one, but better than
          nothing. It includes the time taken to render the page.

          One might reasonably use it to decide whether to load a large graphic
          unconditionally , or only on user request. If a 30 kB page was fetched
          over a link in under a second, it is reasonable to believe that the link
          is fast; if it took over a minute, that it is slow.

          But the data must be treated with considerable caution.

          --
          © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
          <URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang. javascript
          <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
          <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

          Comment

          Working...