It's the -s bit that slows down the program, the stat takes about 5 mins to execute on 10,000 files, while 'ls' throws a listing up in less than 10 secs, and similar performance for Windows 'dir'.

There is something weird about all of this. I did a few tests on a 700mhz W2k box and averaged around 3 seconds to stat 20000 files in a local directory. Doing the readdir into an array had a negligable effect on performance. I also compared against a backticked dir command (I didn't parse it) which took 1 second.

My only idea as to why you are seeing the performance you are is that you are going over a network, but you already said the directories where local so there must be something else going on.

Incidentally I wrote an MD5 dupe checker once and it usually ran over 40k small files spread through a flat directory tree in a matter of minutes, including unlinks.

Yves
--
You are not ready to use symrefs unless you already know why they are bad. -- tadmc (CLPM)


In reply to Re: I'm falling asleep here by demerphq
in thread -s takes too long on 15,000 files by ishk0

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.