This is perl 5.6.1
Rate our_e our_g my_e explicit my_g greedy our_u unpackA m +y_u substr our_e 126/s -- -9% -20% -25% -28% -33% -37% -49% - +54% -56% our_g 139/s 10% -- -11% -17% -21% -26% -30% -44% - +49% -52% my_e 158/s 25% 13% -- -6% -10% -17% -21% -36% - +42% -45% explicit 168/s 33% 20% 6% -- -5% -12% -16% -32% - +38% -42% my_g 175/s 39% 26% 11% 5% -- -7% -12% -29% - +36% -39% greedy 189/s 50% 36% 20% 13% 8% -- -5% -24% - +30% -34% our_u 199/s 58% 43% 26% 19% 13% 5% -- -20% - +27% -31% unpackA 248/s 96% 78% 57% 48% 41% 31% 25% -- +-9% -14% my_u 272/s 116% 95% 73% 63% 55% 44% 37% 10% + -- -5% substr 288/s 128% 106% 83% 72% 64% 52% 45% 16% + 6% --
And the same computer with perl 5.8.3 is _much_ slower.
Rate our_e our_g my_e our_u my_g explicit unpackA greedy m +y_u substr our_e 61.0/s -- -9% -25% -29% -33% -41% -48% -48% - +52% -67% our_g 67.3/s 10% -- -17% -21% -27% -35% -42% -43% - +47% -64% my_e 80.7/s 32% 20% -- -5% -12% -22% -31% -32% - +36% -57% our_u 85.3/s 40% 27% 6% -- -7% -18% -27% -28% - +32% -54% my_g 91.6/s 50% 36% 13% 7% -- -12% -21% -23% - +28% -51% explicit 104/s 70% 54% 28% 22% 13% -- -11% -12% - +18% -44% unpackA 116/s 91% 73% 44% 36% 27% 12% -- -2% +-8% -37% greedy 118/s 94% 76% 47% 39% 29% 14% 2% -- +-6% -36% my_u 126/s 107% 88% 57% 48% 38% 22% 9% 7% + -- -32% substr 186/s 205% 176% 130% 118% 103% 79% 60% 57% +47% --
Boris

In reply to Re^3: fast greedy regex by borisz
in thread fast greedy regex by js1

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.