Just for fun, I rearranged the order of declaration, putting get_value() and get_value2() ahead of a(), b(), and c() (as in No More Meaningless Benchmarks!). Here are the results of the first run:

$ perl oo_benchmark.pl (warning: too few iterations for a reliable count) (warning: too few iterations for a reliable count) (warning: too few iterations for a reliable count) Rate normal optimized direct normal 142857143/s -- -14% -57% optimized 166666667/s 17% -- -50% direct 333333333/s 133% 100% --

Here are the results of my modified program:

$ perl oo_benchmark.pl (warning: too few iterations for a reliable count) (warning: too few iterations for a reliable count) (warning: too few iterations for a reliable count) Rate direct normal optimized direct 125000000/s -- -25% -25% normal 166666667/s 33% -- 0% optimized 166666667/s 33% 0% --

I conclude that these kinds of benchmarks are meaningless.


In reply to Re: Unexpected OO accessor benchmarks by chromatic
in thread Unexpected OO accessor benchmarks by cLive ;-)

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.