Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Efficiency: Recursive functions while de-subbing my program

by sundialsvc4 (Monsignor)
on Jul 13, 2013 at 02:08 UTC ( #1044111=note: print w/ replies, xml ) Need Help??


in reply to Efficiency: Recursive functions while de-subbing my program

Either way, BrowserUK’s original observation is what holds water in this case:   this is an I/O bound operation, so CPU-twiddling isn’t going to translate to a material improvement.   (And the comment that “Perl subs are slow” is, to me, unreliable hearsay.)

It would be useful to time the two functions separately.   How much time, and how much resources, does it actually take to run that “recursive” file search routine.   Try to predict how much time it, alone would take.   Could it, without your being aware of it, be taking more time/resources than it should?   Then, using a list of files that is prepared entirely in-advance, sample the amount of time that the file-processing subroutine requires.   Once more, to predict how much time it, alone would take to do the entire job.  Then, well, does this “jive” with your empirical observations of the actual combined program?   The most likely thing to improve actual runtime ... if it can be significantly improved at all ... will be an algorithm revision of some kind.

Don’t “diddle” code to make it faster:   find a better algorithm.
Kernighan & Plauger:   The Elements of Programming Style


Comment on Re: Efficiency: Recursive functions while de-subbing my program

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (19)
As of 2014-07-24 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (161 votes), past polls