Of course, we then apply the so called "micro optimisations" to that:

buk2 => sub { local $_; 1+index $_[0], $_ or return while $_ = chop $_[1]; 1; },

Though the results of doing so can harldy be called "micro" when they result in an order of magnitude speed up over the non-optimised equivalent; 15 times faster than the next best; and 60 times faster than the original!

c:\test>707621.pl Running benchmarks... Short Rate unpack_allindex unpack_allrindex repellent_unp +ack tye2 tye1 tye0 buk buk2 unpack_allindex 212/s -- -0% - +42% -56% -56% -66% -77% -92% unpack_allrindex 212/s 0% -- - +42% -56% -56% -65% -77% -92% repellent_unpack 365/s 73% 72% + -- -24% -25% -41% -61% -86% tye2 481/s 127% 126% +32% -- -1% -22% -48% -82% tye1 484/s 129% 128% +32% 1% -- -21% -48% -81% tye0 614/s 190% 189% +68% 28% 27% -- -34% -76% buk 930/s 340% 338% 1 +55% 93% 92% 51% -- -64% buk2 2606/s 1132% 1127% 6 +14% 442% 439% 324% 180% -- LongShort Rate unpack_allrindex unpack_allindex repellent_unp +ack tye2 tye1 tye0 buk buk2 unpack_allrindex 271/s -- -1% - +50% -60% -63% -74% -79% -94% unpack_allindex 274/s 1% -- - +49% -60% -63% -73% -79% -94% repellent_unpack 537/s 98% 96% + -- -22% -27% -48% -59% -88% tye2 684/s 152% 150% +27% -- -7% -33% -48% -85% tye1 735/s 171% 169% +37% 7% -- -28% -44% -84% tye0 1027/s 279% 275% +91% 50% 40% -- -21% -77% buk 1306/s 382% 377% 1 +43% 91% 78% 27% -- -71% buk2 4508/s 1563% 1547% 7 +40% 559% 513% 339% 245% -- ShortLong Rate unpack_allrindex unpack_allindex repellent_unp +ack tye0 tye2 tye1 buk buk2 unpack_allrindex 5.41/s -- -2% +-8% -71% -73% -73% -85% -99% unpack_allindex 5.49/s 2% -- +-7% -70% -73% -73% -85% -99% repellent_unpack 5.91/s 9% 8% + -- -68% -71% -71% -84% -99% tye0 18.4/s 241% 236% 2 +12% -- -8% -8% -49% -97% tye2 20.1/s 271% 265% 2 +40% 9% -- -0% -45% -97% tye1 20.1/s 272% 267% 2 +41% 9% 0% -- -45% -97% buk 36.3/s 571% 561% 5 +15% 97% 81% 80% -- -94% buk2 607/s 11128% 10956% 101 +77% 3193% 2926% 2915% 1572% -- LongLong Rate repellent_unpack unpack_allrindex unpack_allin +dex tye0 tye2 tye1 buk buk2 repellent_unpack 5.41/s -- -3% +-6% -70% -73% -73% -85% -99% unpack_allrindex 5.56/s 3% -- +-3% -69% -72% -72% -85% -99% unpack_allindex 5.73/s 6% 3% + -- -68% -71% -71% -84% -99% tye0 18.1/s 235% 226% 2 +17% -- -8% -9% -50% -97% tye2 19.8/s 266% 256% 2 +46% 9% -- -1% -45% -96% tye1 20.0/s 270% 260% 2 +49% 10% 1% -- -45% -96% buk 36.3/s 571% 553% 5 +33% 100% 83% 81% -- -93% buk2 545/s 9980% 9708% 94 +17% 2905% 2652% 2627% 1403% -- VeryLong Rate unpack_allrindex unpack_allindex repellent_un +pack tye2 tye1 tye0 buk buk2 unpack_allrindex 403/s -- -8% +-42% -55% -55% -56% -73% -97% unpack_allindex 439/s 9% -- +-37% -51% -51% -52% -71% -97% repellent_unpack 694/s 72% 58% + -- -23% -23% -24% -54% -95% tye2 897/s 123% 104% + 29% -- -0% -2% -40% -93% tye1 897/s 123% 104% + 29% 0% -- -2% -40% -93% tye0 917/s 128% 109% + 32% 2% 2% -- -39% -93% buk 1493/s 271% 240% +115% 67% 67% 63% -- -89% buk2 13013/s 3132% 2863% 1 +774% 1351% 1351% 1319% 771% --

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^5: Benchmarking "Are all these characters in this sentence?" (quickest yet?) by BrowserUk
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.