in reply to Slowness of /i
I'm sure this is probably mentioned in a few others places, but I remember cause I wrote a patch once for HTML::Template.Q: Why do you use /[Tt]/ instead of /t/i? It's so ugly! A: Simple - the case-insensitive match switch is very inefficient. According to _Mastering_Regular_Expressions_ from O'Reilly Press, /[Tt]/ is faster and more space efficient than /t/i - by as much as double against long strings. //i essentially does a lc() on the string and keeps a temporary copy in memory. When this changes, and it is in the 5.6 development series, I will gladly use //i. Believe me, I realize [Tt] is hideously ugly.
|
|---|