![]() |
|
The stupid question is the question not asked | |
PerlMonks |
Re: Did the inefficiency of /i get fixed?by Belgarion (Chaplain) |
on May 19, 2004 at 04:09 UTC ( #354516=note: print w/replies, xml ) | Need Help?? |
To amplify what sgifford said: it would appear that the longer the string being matched, the bigger the difference between the two methods. For example, using sgifford's script, but with a $s of one character, the numbers on my machine are:
While, when $s is 16KB long, the difference is more pronounced, with the following:
Now the interesting question: sgifford's regex is very simple. What happens when a more complicated test is used. When using the following test code:
produce the following results:
It would appear that the length of the string amplifies the difference more than the complexity of the regular expression. (At least when comparing /[Tt]/ with /t/i.)
In Section
Seekers of Perl Wisdom
|
|