Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by Anonymous Monk
on Mar 19, 2018 at 18:24 UTC ( #1211258=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1211258]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2021-04-21 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?