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

comment on

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

To optimise you need to identify where the time is spent. The most useful tool is Devel::DProf which will detail the percentage of time spent in each section of your code. You are wasting your time doubling the speed of a part of code that only takes up 1% of the total runtime. On the other hand a small improvement in bottleneck areas will reap large benefits. Assuming you have a 'normal' database driven website consider:

  1. Profiling with tools, see Devel::Dprof is your friend
  2. Optimising bottlenecks with Benchmark et al
  3. use mod_perl and Apache::Registry or for vanilla CGI CGI::Simple or CGI.pm in order of speed to process your params.
  4. Generate a cache of static documents for slow changing content rather than serving all requests from a database
  5. Connect to your database once (slow) and use prepare_cached($sql) with ? placeholders in the SQL and then execute(@values)
  6. Think about how much your time is worth versus the cost of new faster equipment or more ram or more processors or faster disks or a better load balancer or....

Often perlcode per say is not the bottleneck. You can't effectively optimise unless you identify where it is worth investing the effort.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Does anyone have a list of 'donts' when optimizing? by tachyon
in thread Does anyone have a list of 'donts' when optimizing? by BUU

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 cooling their heels in the Monastery: (4)
As of 2024-04-24 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found