I wonder about "(OBJECT,FAKE)" and why "MOTHER_RE" is there, and so maybe with pre-compiled qr Perl has to follow this chain to top mother each time it tries to match.

>perl -MDevel::Peek -E "Dump qr/x/" SV = IV(0x2fda530) at 0x2fda540 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x2fda588 SV = REGEXP(0x266a378) at 0x2fda588 REFCNT = 1 FLAGS = (OBJECT,FAKE) PV = 0x26d66a8 "(?^u:x)" CUR = 7 STASH = 0x2656a50 "Regexp" COMPFLAGS = 0x100 () EXTFLAGS = 0x680100 (CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML) ENGINE = 0x6e1a9ee0 (STANDARD) INTFLAGS = 0x0 () NPARENS = 0 LASTPAREN = 0 LASTCLOSEPAREN = 0 MINLEN = 1 MINLENRET = 1 GOFS = 0 PRE_PREFIX = 5 SUBLEN = 0 SUBOFFSET = 0 SUBCOFFSET = 0 SUBBEG = 0x0 MOTHER_RE = 0x26626f8 SV = REGEXP(0x267aff0) at 0x26626f8 REFCNT = 2 FLAGS = () PV = 0x26d66a8 "(?^u:x)" CUR = 7 COMPFLAGS = 0x100 () EXTFLAGS = 0x680100 (CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML) ENGINE = 0x6e1a9ee0 (STANDARD) INTFLAGS = 0x0 () NPARENS = 0 LASTPAREN = 0 LASTCLOSEPAREN = 0 MINLEN = 1 MINLENRET = 1 GOFS = 0 PRE_PREFIX = 5 SUBLEN = 0 SUBOFFSET = 0 SUBCOFFSET = 0 SUBBEG = 0x0 MOTHER_RE = 0x0 PAREN_NAMES = 0x0 SUBSTRS = 0x26b20b8 PPRIVATE = 0x26c16e8 OFFS = 0x26c3878 QR_ANONCV = 0x0 SAVED_COPY = 0x0 PAREN_NAMES = 0x0 SUBSTRS = 0x26b3238 PPRIVATE = 0x26c16e8 OFFS = 0x26c3ab8 QR_ANONCV = 0x0 SAVED_COPY = 0x0

p.s. BTW, to answer 1205970, $re is compiled once, either checking debug output, or "hoisting" first line of subroutine to top of the script, performance remains the same.


In reply to Re: Performance penalty of using qr// by vr
in thread Performance penalty of using qr// by Athanasius

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.