Have you ever thought of using memory mapped files ...

For other things yes, but not for this. I'm not sure how that would work for this application? Especially as the files are text files and are read/written in terms of lines.

The scenario is that (at different stages in the application), I'm interleaving either reads from, or writes to, many files. This has the affect of causing the disk head to need to dance all over the disk whenever a 4k buffer is used up. If I can buffer (say) 1MB at a time, that will cut the number of disk seeks by 1/256, which should have a significant affect on throughput.

If I use memory mapping I have to bypass the OS/CRT/PERLIO line handling, and by moving that into Perl I think I would loose more than I might gain.

Configurable CRT buffer sizes avoids that problem. Maybe the right solution is to write a module that gives back direct access to the CRT stdio on all platforms.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^4: Configurable IO buffersize? by BrowserUk
in thread Configurable IO buffersize? by BrowserUk

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.