fast regex
Nobody
nobody at nowhere.com
Tue May 11 15:46:33 EDT 2010
On Tue, 11 May 2010 17:48:41 +1200, Lawrence D'Oliveiro wrote:
>> I was working with regex on a very large text, really large but I have
>> time constrained.
>
> “Fast regex” is a contradiction in terms.
Not at all. A properly-written regexp engine will be limited only by
memory bandwidth, provided that the state table fits into the primary
cache.
> You use regexes when you
> want ease of definition and application, not speed.
Other way around.
> For speed, consider hand-coding your own state machine. Preferably in a
> compiled language like C.
Or use a decent regexp library.
Even if you want to use non-regular expressions (e.g. backreferences), a
decent engine will still use a DFA, bactracking only where strictly
necessary.
More information about the Python-list
mailing list