Re: Speed comparison of regex versus index, lc, and / /i
- From: Ben Bullock <benkasminbullock@xxxxxxxxx>
- Date: Fri, 30 May 2008 14:10:09 +0000 (UTC)
On Fri, 30 May 2008 13:28:21 +0000, John W. Krahn wrote:
Just the opposite. AFAIK if searching for a literal string (as opposed
to a regular expression pattern) the regexp engine will use the same
algorithm as index().
I don't know what it does internally, but actually using non-literal
strings in the regular expression match like "something|else" or
"first.*second" did not result in a significant slowdown. The search
string did not change at all during the execution of the program, so
the regular expression would only have been compiled once.
I assume that most of the slowdown was caused by the introduction of the
use of UTF, etc.
No - the "lc"-related slowdown was experienced even if I read in the
files as bytes and did not convert them into anything. I'm sure of
this because I converted to using UTF-8 halfway through coding because
of an unrelated problem, and by that point I'd already noticed that "lc"
or / /i more than doubled the time of the program execution. In fact at the
same time that I converted the searched files into UTF-8, I also converted
them to lower case.
.
- Follow-Ups:
- Re: Speed comparison of regex versus index, lc, and / /i
- From: nolo contendere
- Re: Speed comparison of regex versus index, lc, and / /i
- References:
- Speed comparison of regex versus index, lc, and / /i
- From: Ben Bullock
- Re: Speed comparison of regex versus index, lc, and / /i
- From: John W. Krahn
- Speed comparison of regex versus index, lc, and / /i
- Prev by Date: Re: Need help with a simple (I think) Perl script
- Next by Date: Re: Using perl locally on a Windows XP system
- Previous by thread: Re: Speed comparison of regex versus index, lc, and / /i
- Next by thread: Re: Speed comparison of regex versus index, lc, and / /i
- Index(es):
Relevant Pages
|
|