in reply to How useful is the /o regexp modifier?
Your benchmark basically shows that on perl-5.8.8, the qr, qr/o and /o variants have the same run time, and when I run it multiple times, it actually fluctuates enough to call the differences "noise".
On perl-5.10.0 the /o variant is consistently ~33% faster than qr/ and qr/o.
But remeber that your cases are pretty pathologic in that the regex is rather unusually long, and the string is shorter than the text representation of the regex. If you increase the length of your strings by a factor of 10, you're again in a regime where the run time differences are smaller than 5% (and this time all of them), so I'd conclude that for any practical purpose the possible small efficiency gain is neglectable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How useful is the /o regexp modifier?
by kyle (Abbot) on Feb 04, 2009 at 04:03 UTC | |
by jethro (Monsignor) on Feb 04, 2009 at 14:19 UTC |