Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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 http://stackoverflow.com/questions/4371714/how-do-i-profile-my-perl-programs).

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 validate.pl 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2014-12-21 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (103 votes), past polls