Greetings all,

I am currently doing some contract programming for a printing company who receive large (anywhere from 15 Meg to 150 Meg) text files containing thousands of text statements. My scripts perform various operations on these statement files, the simplest pulling names/addresses (at specific line/positions per page) and outputting them into a different file.
The scripts are very straightforward (read until find page marker, take name/addr from line# X, dump to other file, carry on)... I installed a simple percentage counter to see the current progress (bytes read/total bytes in file).

My boggle is this:
As the programme progresses through the file, it slows down, until as it reaches the very end it appears (from when it started the file) to really be crawling. The script does complete its task correctly, nothing is freezing, but I'm still interested into why it slows down.
I use a read() to pull byte by byte (looking for top-of-page hex marker, since pages are all different lengths).
Nothing is stored in memory but the temporary name/addr that it pulls from the master file, and then outputs.

Any ideas? -- Alexander Widdlemouse undid his bellybutton and his bum dropped off --


In reply to Perl scripts slowing down towards end of file processing by JPaul

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.