3 ms·
I guess that adding timeouts can significantly decrease the run time efficiency?
by nsajko 4y ago
I guess that adding timeouts can significantly decrease the run time efficiency?
- Someone 4y agoIt can, but this isn’t a hard timeout. From the description (“The MatchTimeout property defines the approximate maximum time interval for a Regex instance to execute”), it seems they have their regex engine periodically (say after handling every 10,000 instructions of the compiled regex) check whether they went over the limit.
- orra 4y agoPlus, as a general point, .NET has pretty decent performance. It's no C++, but at the same time substantial effort is put into optimisation. In fact for both .NET v5 and v7, they specifically did work to improve the performance of regexes. For example there is a new non-backtracking option. https://devblogs.microsoft.com/dotnet/regular-expression-improvements-in-dotnet-7/ https://devblogs.microsoft.com/dotnet/regular-expression-imp...