in reply to Perl regexp matching is slow??
I ran a quick program to sort the regular expressions used in core perl into things that could be turned into DFAs and the ones that can't (anything with back references). There are 1075 transformable regexps and three non-transformable regexps. Potentially we could benefit by using a DFA engine when the regexp doesn't require back references. This has the drawback that the behaviour is going to change. There are usually many potential results from matching a regexp against a string but because of the expected order of execution we get the one we desire. With a DFA, the results that are returned will come out in a different order. This is something that potentially you'd want to indicate is acceptable with a pragma.
If you'd like to read more about this topic see Practical Parsing (an excellent and readable text) and also "The Dragon Book".
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl regexp matching is slow??
by TimToady (Parson) on Jan 30, 2007 at 21:21 UTC | |
Re^2: Perl regexp matching is slow??
by diotalevi (Canon) on Jan 31, 2007 at 04:42 UTC | |
by demerphq (Chancellor) on Feb 27, 2007 at 22:02 UTC | |
by diotalevi (Canon) on Mar 01, 2007 at 02:28 UTC |