I already pointed out that performance issues are usually irrelevant in the question of whether to choose an OO design. However algorithms are also often irrelevant in whether to choose an OO design. Generally speaking you can write the same algorithms in any programming paradigm. OK, so some of them come more naturally in one paradigm than another, but the ones that come most naturally in an OO design are often not particularly efficient. Quite the contrary in fact.

For instance your memoizing object is the same algorithm as using an access function that memoizes its return. And using Dominus' Memoize module takes less setup work.

Now programming paradigms have a huge effect on overall program design. They affect how easy it is to swap out one algorithm for another (in obvious and not so obvious ways). I am not saying that all paradigms are created equal. (OTOH I think that which one is "best" depends on circumstances.) But in general programming people who think that raw performance is a good reason for them to choose one paradigm over another are generally wrong. And likewise decent paradigms are not distinguished by what algorithms they can express. (Now ease of expression is a different story...)


In reply to Re (tilly) 1: The proof is in the pudding, my friends by tilly
in thread Using tie to initialize large datastructures by htoug

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.