Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by locked_user sundialsvc4 (Abbot)
on Jul 13, 2013 at 02:08 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2026-02-12 04:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.