Good point. My assumption when I wrote the code was that the testFn routines were going to be fairly expensive, so benchmark_routine wasn't unacceptable overhead.

I should have written separate test and benchmark routines, rather than let the benchmark run and check my test cases.

Re-running the tests with the 1..20 fix you suggested does alter the percentages between tests, but doesn't change the relative rankings much.

Short

tallulah_OriginalPost             107/s
Tanktalus_AllRegex_Study          124/s
Tanktalus_AllRegex                130/s
varian_hash                       152/s
RMGir_slice                       207/s
moritz_BuildRegex_WithStudy       243/s
moritz_BuildRegex                 261/s
Tanktalus_AllIndex                452/s
RMGir_index                       678/s


LongShort                   

varian_hash                      4.76/s
RMGir_slice                      5.77/s
tallulah_OriginalPost             166/s
Tanktalus_AllRegex_Study          169/s
Tanktalus_AllRegex                207/s
moritz_BuildRegex_WithStudy       241/s
moritz_BuildRegex                 395/s
Tanktalus_AllIndex                731/s
RMGir_index                      1000/s


ShortLong

tallulah_OriginalPost            3.15/s
Tanktalus_AllRegex_Study         4.27/s
Tanktalus_AllRegex               4.31/s
moritz_BuildRegex_WithStudy      5.22/s
moritz_BuildRegex                5.26/s
varian_hash                      7.84/s
RMGir_index                      13.9/s
RMGir_slice                      15.3/s
Tanktalus_AllIndex               15.8/s


LongLong

tallulah_OriginalPost            3.17/s
Tanktalus_AllRegex_Study         4.24/s
varian_hash                      4.35/s
Tanktalus_AllRegex               4.35/s
moritz_BuildRegex                5.17/s
moritz_BuildRegex_WithStudy      5.22/s
RMGir_slice                      6.60/s
RMGir_index                      12.5/s
Tanktalus_AllIndex               15.5/s


Mike

In reply to Re^2: Benchmarking "Are all these characters in this sentence?" by RMGir
in thread Benchmarking "Are all these characters in this sentence?" by RMGir

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.