http://qs321.pair.com?node_id=1211258


in reply to Perl Program to efficiently process 500000 small files in a Directory (AIX)

"Commenting out the move" does not mean that "move is the culprit." It might well instead mean that the directory-walk ran much faster! Try this: modify the program to walk the directory and to write out the qualifying filenames to a separate temporary file. Next, run (and time) a separate program which reads that temporary file, and which therefore is not performing a directory walk at the same time. Directory walks often rely on caches (for speed) that must be invalidated when the content of the filesystem is changed. If you measured the amount of time between each successive "hit" in your directory walk, in the present program, you just might discover that it's running slower, and slower, and slower . . . all this because you're altering the directory structure at the same time.
  • Comment on Re: Perl Program to efficiently process 500000 small files in a Directory (AIX)

Replies are listed 'Best First'.
Re^2: Perl Program to efficiently process 500000 small files in a Directory (AIX)
by Anonymous Monk on Mar 19, 2018 at 18:25 UTC
    ... also note that dividing this into two parallel processes, e.g. linked by a Unix/Linux pipe, would not be the same as using a temporary disk file as the intermediate buffer and doing the work in two separate stages.