Optimize for clarity, not speed. As Donald Knuth once said, "premature optimization is the root of all evil." Rarely, if ever, can we adequately determine exactly what parts of the program are going to truly be the performance hogs. If you starting developing your code with optimization as the primary goal, you're going to shoot yourself in the foot. After all, you already know the benefits of writing clear, easily maintainable code. Why risk losing those benefits for the unknown benefit of a performance increase when you don't yet know that performance is an issue!?

Consider the following: you have three main processes, A, B, and C. After working on B, you realize that you can spend about a week working on it to increase B's performance by 90%. Wow! That's a huge saving. If, however, you discover that the actual production usage of B is only 5% before optimization, then you probably wasted a week. What if you can only improve A's performance by 25% with a week worth of rewriting? If A takes up 50% of the total run time of the system (before optimization), then you have more profitably spent your week. However, it's often difficult, if not impossible, to truly gauge production usage of our systems until we get real data and put our systems through their paces.

Further, with a system as large as you are describing, it's even more important to not optimize for speed while you're developing it. Since those optimizations tend to reduce clarity, you wind up having a huge, difficult to maintain system with optimizations that are probably not, well, optimal. Trust me, maintenance programmers will appreciate having a slow, but easy to maintain system that can then be fine-tuned.

Once you have your system near completion or actually in production, then you can start using Devel::Dprof and other tools to figure out where your performance issues are.

Cheers,
Ovid

Vote for paco!

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re: Sheer Size by Ovid
in thread Sheer Size by blackjudas

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.