Opening the file will take a few milliseconds. Reading the whole thing a few milliseconds more. This is not your problem. Nor is memory an issue - this is a small file. Read it line by line or slurp it all in. It does not matter.

Your problem is bandwidth. Let's say 15 chars per address 15 * 20,000 = 300,000 bytes. Sending 300,000 bytes (300kB) across the internet embedded in an HTML form (scrolling text box) is what takes the time. I assume this is what you are doing given the context.

A 56k modem gets a max of 56,000 bits per second. Let's be optimistic and assume you actually get this. There are 8 bits in a byte so a 56K modem is good for 56,000 / 8 = 7000 bytes per second. So we now understand that 300,000 / 7000 = 42 seconds download. This is the minimum. In the real world double it or more as 56K only happens in perfect conditions. If you want speed you need to change your logic and limit the download.

There are some tricks you can use to get the partially downloaded data to render (display) faster but if you want zeus@zod.com you will be waiting until it all comes down.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Displaying a Large File by tachyon
in thread Displaying a Large File by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.