Copied from chatterbox: saskaqueer's mind boggles over the newest SoPW. Imagine a "magical module out there" that could "save a bunch of files with only one I/O call". That'd be amazing to see ;)

That aside, I'd say 20 seconds isn't too bad for creating and manipulating 417 files. If your code can use any adjustments for speed, it would most likely be with the code you are using to split up a chunk of data into 12 records per file. If the bottleneck here is indeed the file I/O for outputting the new files, then that's about the best you're going to get.

How are you reading in this 5000+ record file? Are you reading it in all at once into memory, or are you looping through it 12 records at a time to split it up? If you're pulling everything into memory at once, that might be your problem there.


In reply to Re: Quickest way to write multiple files by saskaqueer
in thread Quickest way to write multiple files 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.