"We should forget about small efficiencies, about 97% of the time. Premature optimization is the root of all evil."
-- Donald Knuth

Your time as a programmer is very valuable, and if you're spending a substantial time re-inventing the wheel, you're not allocating your time optimally, either from your own perspective, your employer, or the community at large. If some library is broken, or inadquate, by all means create a better wheel, but make sure that your efforts are not gratuitous.

I used to fall into this trap all the time, but I eventually realized the futility of it. Oft times a library that you can import from elsewhere will have already hashed out all of the subtleties and painfully slogged through the pitfalls. Stand on the shoulders of the creators instead of reliving their travails.

Take care of the big picture first, and don't get bogged down in the minutia. Not only may you gain minimal performace boost, but your code may not even be functionally correct if it is a complex problem. You might not even fully comprehend the comlexity of the problem. For evidence of this, look no farther than the regex required to properly and exhaustively validate email addresses.

Later in the project, when you've got your functionality down pat, shift your attention to the internals, going back and sussing out the bottlenecks. If you can isolate a particular library as a drag on your throughput, then and only then go to the trouble to rewrite it yourself.


In reply to Inadequate laziness, false hubris by skyknight
in thread To USE or not to USE by draconis

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.