Just another Perl shrine | |
PerlMonks |
Re^9: Common Perl Pitfallsby JavaFan (Canon) |
on Apr 11, 2012 at 20:57 UTC ( [id://964625]=note: print w/replies, xml ) | Need Help?? |
Oh, sure. And I don't give a damn about the difference in compilation speed of trivial small regexes.
But when the regexes get large, and difference of compiling the patterns is a few seconds vs a few minutes, I do care. But still, even in your simple example, it's three compilations + two stringifications vs a single compile. Here's a benchmark, 1 compilation vs 12 compilations and 20 stringifications: That's with 5.15.9 (on OSX). With 5.12.3 (same box), I get: And, for kicks, with 5.8.9 (again, same box): The resulting patterns, while identical, also differ significantly in size: the one build with repeated qr constructs is 19 times the size of the one build with qq. I'm usually not a stickler for speed. But I make an exception when it comes to qr.
In Section
Meditations
|
|