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
- 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.
- 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).
- Often, the compilation time is dwarved by the runtime anyway.
- You'd have to be careful -- if you interpolate your compiled pattern into a larger one, you're paying the price of compilation twice.
|