Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Problem with pre-compiled regex

by JavaFan (Canon)
on Jan 17, 2012 at 16:45 UTC ( [id://948352]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Problem with pre-compiled regex
in thread Problem with pre-compiled regex

shouldn't the pre-compiled regex run faster because of pre-compilation
  1. Both your regexp and your program are fairly trivial. Even if there wasn't any caching involved for non-precompiled regexes, I doubt you'd notice the difference. Whether that's the case for your real $text, I do not know.
  2. Perl has been caching compiled patterns since the 20th century. (5.004 or 5.005, IIRC). This is why /o is usually pointless (if not broken).
  3. Often, the compilation time is dwarved by the runtime anyway.
  4. You'd have to be careful -- if you interpolate your compiled pattern into a larger one, you're paying the price of compilation twice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found