On Mon, 2013-07-01 at 20:31 +0000, Joe Gooch wrote:
> ... Then it’s a single regex match.  (Albeit a complicated one… I’ve never 
> benchmarked 1000 regex_matches vs a pattern with 1000 ors)

A regex match runs in O(len(S)), where S is the string being matched.
The complexity of the pattern makes no real difference, it is compiled
to an optimised finite state machine. You pay a few bytes in memory
usage, but at runtime it is just a table look-up.

1000 regex matches would be 1000 times slower!
-- 
Robert Segall
Apsis GmbH
Postfach, Uetikon am See, CH-8707
Tel: +41-32-512 30 19


--
To unsubscribe send an email with subject unsubscribe to [email protected].
Please contact [email protected] for questions.

Reply via email to