Don't quote me out of context. I was replying to BrowserUKs technique of putting the loop inside the code to benchmark. Once you put the (or a) loop into the code you benchmark, anything Benchmark.pm tries to do compensate for running an empty loop is fruitless.

Yes I agree. And i quoted you out of context because I wanted to make a point about what Benchmark does wrong, not set you up or make you look dumb or anything. Sorry if it seemed that way.

Now, do I care whether the it also times the overhead of the loop? No. Either the overhead of the loop is significant, or not. If it's significant, it doesn't matter (for a performance point of view) which solution I pick.

I agree entirely.

Now, if I really want to be fancy (and when I do need to benchmark something more seriously than something trivial on perlmonks), I run the benchmark 100 or 1000 times, keeping track of the results, ..... And I do it with different datasets. All things Benchmark doesn't support anyway.

Ive often wanted, and a few times tinkered with a more flexible and less "clever" Benchmark framework.

---
$world=~s/war/peace/g


In reply to Re^9: &1 is no faster than %2 when checking for oddness. (Careful what you benchmark) by demerphq
in thread &1 is no faster than %2 when checking for oddness. Oh well. by diotalevi

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.