Our filesystem gets too much wear and tear

I call "premature optimisation." I find it extremely unlikely that this actually will save much, if any, speed, and pretty much impossible that consecutive hits to the same directory will actually touch the physical media in any way, shape, or form. Your hard disk has a cache. Your filesystem driver has a cache. Your C library has a cache. I doubt that all of these will be emptied between the time that File::Find calls lstat and the time that your wanted sub calls lstat. If so, you probably have bigger issues than just how hard your perl code is hitting the disk.

If anything, using _ merely avoids the repeated call to the C library's stat or lstat function, so you can save some function call overhead. But when you're hitting 34,000 files, I somehow doubt that CPU time is your limiting factor in your application's speed.

Thus, my suggestion: relax. Don't fret the small stuff ;-)


In reply to Re: Can the special underline filehandle (stat cache) be cleared? by Tanktalus
in thread Can the special underline filehandle (stat cache) be cleared? by ammon

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.