Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

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

  1. Ok, this one I discussed in an earlier reply.
  2. Faster accessors.... Do you know which portions of code are causing problems? Faster accessors only make sense if you've got a slow one causing you trouble. And even then, "trimming cycles" is often much less effective than "a more efficient algorithm"
  3. Yes, I would suggest avoiding calling any code that doesn't do anything. Especially if it does nothing in O(n^2) time. ;) How to detect that it's not doing anything? I guess you've got to look at what it's designed to do, ask why that's useful, and if you determine that it's not doing anything useful, stop calling it. A good regression test suite is helpful when doing that sort of refactoring.
  4. Exiting loops early is an optimization on a linear operation. Lazy initialization or lazy evaluation is a technique where you do some expensive work just in time, with the hope that maybe you never have to do it at all. If you know you've got to do it, sometimes an opposite technique of pulling as much of the work into startup time as possible can also be beneficial. Which is best for your application has to be your decision based on a lot of factors.
  5. If you're going to go about rearranging code that does work but just looks silly, especially when it's not really impacting performance, be sure that you've got good regression tests in place first, or just leave it alone.

Dave


In reply to Re: how to improve the performance of a perl program by davido
in thread 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 chanting in the Monastery: (6)
As of 2024-04-25 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found