Many years ago, when it was common for companies to send programmers off to workshops, a friend attended one for PL/1 programmers. During this workshop, people were grouped into teams, and given a problem to solve. One of the teams got off onto a discussion about the most efficient way to code a particular type of loop. (In PL/1, like Perl, there is often more than one way to do something.)

The discussion got rather heated, with lots of handwaving and citing of expert opinion. When the workshop broke for the evening, the argument continued in the hotel bar. A few people were heard discussing the merits of alternate loop strategies the next morning at breakfast.

By this point, the other teams were curious. For an argument this big, there must be something important going on -- some key technical learning to take home and impress the boss with. So, when the "most efficient loop" team presented their barely completed solution, everyone paid a lot of attention.

Their solution used the loop type they'd been arguing about exactly once, in initialization code. For all of the hours, and extra hours, they'd spent arguing about efficiency, the effect on the performance of their (barely completed) solution was negligible. The other teams hadn't gotten sidetracked, and all produced more elegant solutions.


This was many years ago. Since then, technology has advanced considerably. It's a lot easier now to prototype benchmark alternatives. Human nature, though, hasn't changed, and the lesson from this workshop of many years ago is just as true now as it was then:

Before you spend a lot of time and effort arguing over performance, make sure it matters.


In reply to Which way is faster? by dws

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.