in reply to Re^3: File::find preprocess problem
in thread File::find preprocess problem

I don't understand why so many folks like these other modules when a simple find() will often do the job!
I guess the documentation could be improved?

File::Find is a core module and it runs really fast. My hint about this special underscore variable -> that can make a big difference. It took me awhile to learn that "trick", but I very sure that this is true. That is basically about a 2x performance increase if you are doing 2 file tests.

The overhead to call a subroutine with no args (which is what find() does), is pretty much nothing compared with a file system operation.

I'm not sure that running \$preprocess even helps in OP's application. Weirdly enough, it may actually be slower due to the processing before calling \$wanted(). But this depends upon how many files/directories are underneath the /advanced/ path's and whether pruning these descent path's out from the directory descent really helps. Also how significant are the number of simple files that are not log files? Maybe these are huge in number to the .log files, maybe not.

From my experience, the single thing that will drive the performance, is the number of stat(), file system operations.

Replies are listed 'Best First'.
Re^5: File::find preprocess problem
by Anonymous Monk on Apr 27, 2012 at 14:16 UTC
Re^5: File::find preprocess problem
by zentara (Cardinal) on Apr 27, 2012 at 14:48 UTC
    I don't understand why ..... a simple find() will often do the job...File::Find is a core module and it runs really fast

    Just look at the discussion in this node, and you have your answer. :-) It needs a cookbook of runnable examples.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re^5: File::find preprocess problem
by Anonymous Monk on Apr 28, 2012 at 03:07 UTC
    I have to say I have not done any preprocessing before calling &File::Find::wanted yet. All the sorting happens in there. And, I certainly do not feel compeled enough to run any benchmark (but I can be convinced if other do).

      Rot I thus: I certainly do not feel compeled ...

      Well, I feel strong enough now to note that correct spelling of the last word above should be "compelled".