One case where people caution against optimization is optimization that causes extreme obfuscation. There are many key numbers you need to track when considering optimization: cost of coder time, cost of new hardware, time being spent on certain parts of a program, time originally coding vs. maintenance, actual time seen by a user, etc.

What people caution against is a knee-jerk type of optimization where a coder dives into an algorithm and emerges with a few more micro-seconds and a blob of horribly unmaintainable code.

Rather, code it cleanly and correctly from the start. If it's too slow (quantify and measure that), consider faster hardware first, it's usually cheaper than coder time over the long run. If your hardware is already good, identify the source of the majority of the slowness. Once you have metrics that point at your target, optimize that code with appropriate commenting to explain what you are doing and why. Re-test and verify you've made it fast enough.

So optimization isn't bad, it's just not the first thing you should jump on when something seems slow.


In reply to Re: Optimisation isn't a dirty word. by cbrandtbuffalo
in thread Optimisation isn't a dirty word. by BrowserUk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.