how to wrap a large alternation of literals in word boundary assertions and have it be fast? #890
-
Hi, to match efficiently large amounts of alternations, I guess it is interesting to trigger Line 91 in 9ca3099
The question is: is there any way to use word boundaries in such a way this expression is highly optimized for a thing like this?
or with And... regarding PERFORMANCE documentation here
this previously stated regex would be in the set of "no problem" ? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've turned this into a feature request in #891.
Yes. But that doesn't mean it gets the Aho-Corasick optimization. The section you're quoting is really written relative to backtracking engines. Namely, a backtracking engine will (absent other optimizations) try each alternate one after the other. This will wind up being slower than even the slowest regex engine in this crate (the PikeVM). I am being somewhat hand wavy here. Being precise here without concrete examples in front of us is difficult. |
Beta Was this translation helpful? Give feedback.
I've turned this into a feature request in #891.
Yes. But that doesn't mean it gets the Aho-Corasick optimization. The section you're quoting is really written relative to backtracking engines. Namely, a backtracking engine will (absent other optimizations) try each alternate one after the other. This will wind up being slower than even the slowest regex engine in this crate (the PikeVM).
I am being somewhat hand wavy here. Being precise here without concrete examples in front …