Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi
I have a gui-based tool written in perl tk which can run jobs in thousands. But we are trying to scale up the gui so that it can run nearly 1lac job without getting hung.
The code base is very huge and comprised of near about 60-70 module files. It uses socket connection for inter-process communication and MySQL for storing data. I need to profile this huge perl code base to know what could be the bottlenecks for running lacs of jobs and how can I overcome that ?
Can anybody please suggest me any good mechanism to know the bottlenecks and do profiling. I have come to know about Devel::NYFTProf but not quite able to understand how to use it. The gui has a launching script which in turn calls some more scripts using some modules.
I have come to know of following things but not quite sure how can they be helpful and how to find out his problem in my huge code

1.Avoid->repeated->chains->of->accssors(..) . Instead use temprorary variables.
Question is how come it will help if I avoid repeated chains of function call and use temp variable. Also how can I look in my huge code where all such chain calls are happening?

2. Use faster accessors as
Class::Accessor
-> Class::Accessor::Fast
---> Class::Accessor::Faster
----->Class::XSAccessor

3. Avoid calling subs that don't do anything. How can I detect this ? Any mechanism ?

4. Exit subs and loops early , delay initialization

return if not ... a cheap test...; return if not ... a more expensive test..; my $foo = ..initialization...; ...body of sub routine ...
5. Fixing silly code as below :
return exists $hash{$a}{$key}?$hash{$a}{$key} : undef; return $hash{$a}{$key}; # instead of above

Thanks

In reply to how to improve the performance of a perl program by ghosh123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-23 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found