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".
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re: Perl regexp matching is slow??
by diotalevi
in thread Perl regexp matching is slow??
by smahesh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |