Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Performance penalty of using qr//

by vr (Curate)
on Dec 21, 2017 at 10:53 UTC ( [id://1205971]=note: print w/replies, xml ) Need Help??


in reply to Performance penalty of using qr//

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1205971]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-24 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found