Open DrRataplan opened 4 years ago
Another common optimization is to compute the minimum length of any valid input, e.g. 2147483647
in the provided example, during parse. If the length of the input, aaa
is less than the minimum required input there is no way it can match so we shouldn't even attempt to do so.
See https://github.com/dotnet/runtime/issues/1349 and https://github.com/dotnet/runtime/pull/1348 for some recent optimizations made to the .NET Regex engine. Most of them are irrelevant but there may be some insight in those issues.
The following test from the QT3 test set that FontoXPath uses causes a crash:
It runs out of memory when compiling the huge program for the
a{2147483647}
pattern. We could try to detect these patalogically large minoccurs, compile the as if they werea+
and go over the whynot traces to see whether our minOccurs matches?