Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: File::find preprocess problem

by Marshall (Canon)
on Apr 27, 2012 at 11:51 UTC ( [id://967603]=note: print w/replies, xml ) Need Help??


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

    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?

    Sure you do : It is tons easier, requires less brain power to use, has a more memorable interface

    When is the last time you saw a question about how to use File::Find::Rule or Path::Class::Rule?

    ?node_id=3989;HIT=File%3A%3AFind%3A%3ARule;re=N

    Found 11 nodes roughly between 2012-04-27 and 1999-10-04 (searched 100.00% of DB).

    where title contains "File::Find::Rule"

    ?node_id=3989;HIT=File%3A%3AFind%20;HIS=%3B;re=N

    Found 50 nodes roughly between 2012-04-27 and 2005-08-24 (searched 49.73% of DB).

    Found 50 nodes roughly between 2005-08-24 and 2001-09-24 (searched 38.44% of DB).

    Found 20 nodes roughly between 2001-09-24 and 1999-10-04 (searched 11.82% of DB).

    Gee, 11 versus 120, and that is just on perlmonks

Re^5: File::find preprocess problem
by zentara (Archbishop) 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".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-26 03:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found