On perl 5.8.0 i686-linux-thread-multi with debugging:

$ perl testRegexen.pl Benchmark: running capture, noCapture, noParens, twoRegexen for at lea +st 3 CPU seconds... capture: 4 wallclock secs ( 3.20 usr + 0.00 sys = 3.20 CPU) @ 14 +1750.00/s (n=453600) noCapture: 3 wallclock secs ( 3.04 usr + 0.02 sys = 3.06 CPU) @ 27 +9933.01/s (n=856595) noParens: 1 wallclock secs ( 3.34 usr + 0.00 sys = 3.34 CPU) @ 26 +1686.53/s (n=874033) twoRegexen: 5 wallclock secs ( 3.41 usr + 0.01 sys = 3.42 CPU) @ 54 +0171.35/s (n=1847386) Rate capture noParens noCapture twoRegexen capture 141750/s -- -46% -49% -74% noParens 261687/s 85% -- -7% -52% noCapture 279933/s 97% 7% -- -48% twoRegexen 540171/s 281% 106% 93% -- $

Update: perl -Dr output, per request:

$ perl -Dr testRegexen.pl Compiling REx `(est|\d)' size 10 Got 84 bytes for offset annotations. first at 3 1: OPEN1(3) 3: BRANCH(6) 4: EXACT <est>(8) 6: BRANCH(8) 7: DIGIT(8) 8: CLOSE1(10) 10: END(0) minlen 1 Offsets: [10] 1[1] 0[0] 1[1] 2[3] 0[0] 5[1] 6[2] 8[1] 0[0] 9[0] Compiling REx `(?:est|\d)' size 7 Got 60 bytes for offset annotations. 1: BRANCH(4) 2: EXACT <est>(7) 4: BRANCH(6) 5: DIGIT(7) 6: TAIL(7) 7: END(0) minlen 1 Offsets: [7] 3[1] 4[3] 0[0] 7[1] 8[2] 9[0] 11[0] Compiling REx `est|\d' size 6 Got 52 bytes for offset annotations. 1: BRANCH(4) 2: EXACT <est>(6) 4: BRANCH(6) 5: DIGIT(6) 6: END(0) minlen 1 Offsets: [6] 0[0] 1[3] 0[0] 4[1] 5[2] 7[0] Compiling REx `est' size 3 Got 28 bytes for offset annotations. first at 1 rarest char s at 1 1: EXACT <est>(3) 3: END(0) anchored `est' at 0 (checking anchored isall) minlen 3 Offsets: [3] 1[3] 0[0] 4[0] Compiling REx `\d' size 2 Got 20 bytes for offset annotations. first at 1 1: DIGIT(2) 2: END(0) stclass `DIGIT' minlen 1 Offsets: [2] 1[2] 3[0] Omitting $` $& $' support. EXECUTING... $

After Compline,
Zaxo


In reply to Re: Re: RE performance by Zaxo
in thread RE performance by Vennis

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.