Actually, that wasn't a bad idea. Using the hypothetical data set from my response to Eric below, I benchmarked the 2 subs initially posted in this thread. At 50k iterations, here's what I got:

Benchmark: timing 50000 iterations of mybinary, use_grep... mybinary: 15 wallclock secs (15.23 usr + 0.03 sys = 15.26 CPU) @ 32 +76.54/s (n=50000) use_grep: 13 wallclock secs (12.83 usr + 0.04 sys = 12.87 CPU) @ 38 +85.00/s (n=50000) Rate mybinary use_grep mybinary 3277/s -- -16% useagrep 3885/s 19% --

I have not yet tried BrowserUK's latest edition sub yet. That's for this afternoon/evening.

Matt


In reply to Re^4: Help tightening up a subroutine please by mdunnbass
in thread Help tightening up a subroutine please by mdunnbass

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.