Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: require sugesstions for writing a perl script

by topher (Scribe)
on Mar 06, 2013 at 15:56 UTC ( #1022020=note: print w/ replies, xml ) Need Help??

in reply to require sugesstions for writing a perl script

I require suggestions for writing a perl script which reduces or uses less CPU & Memory utilization during execution of a program.

If you want suggestions for reducing the CPU or Memory of your program, you're going to have to provide a lot more details (and code) for your program. Right now, all we can do is make vague and general guesses and suggestions around the process.

As for those suggestions we can provide . . . there's a lot of ways this can potentially be improved. First of all, you need to review your validation script, and see if there are ways it can be made faster. There are lots of ways to profile your script, the most popular current tool being Devel::NYTProf. There are articles and posts out there that offer suggestions, too (such as

Another thing that could help would be to move your file finding/handling into your Perl script. Running it from the shell script means that you're starting the Perl interpreter 1000 separate times. Depending on what and how many modules you're loading, that can start to add up.

I know Parallel::ForkManager has already been suggested, and you'd be wise to investigate it. It will allow you to easily process multiple files simultaneously in a more control manner. Finding the right number of concurrent processes for maximum performance may require some testing, though.

That's about all I can think of off the top of my head without more information on what is doing, how big the files it's validating are, what format the files are, etc.

Christopher Cashell

Comment on Re: require sugesstions for writing a perl script

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2015-11-26 13:31 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (700 votes), past polls