Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to optimize CPU and Memory usage?

by davido (Archbishop)
on Nov 23, 2013 at 16:55 UTC ( #1064046=note: print w/replies, xml ) Need Help??


in reply to How to optimize CPU and Memory usage?

Do you have memory leaks? They're harder to come by in Perl code than in a language like C or C++, though still possible. It's pretty old, but there is Devel::LeakTrace, if you believe you have one you need to track down. For me sometimes a first step is to create a test that puts a module through a lot of iterations, and then just observe "top". Old fashioned, but low effort. If that turns up anything interesting, then I spend the time to dig deeper. The two most common sources of memory leaks in Perl are circular references, and buggy XS code.

As for CPU optimization, profile first (Devel::NYTProf), and if you really do have a problem somewhere, then you can Benchmark alternatives.


Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1064046]
help
Chatterbox?
[Corion]: My household somewhat becomes a Dell stronghold since I threw out HP for not wanting to scan documents because of an empty ink cartridge ;)
[1nickt]: Wow. I had heard about the chips on HP cartriddges but not that issue. I rejected HP's equivalent laptop becuase of build quality, very plasticky keyboard. And I believe HP is the champon of bloatware, too.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2017-03-27 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.