You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The static Regex functions internally cache parsed regex instances based on the provided pattern on .NET 5+. ValueMatchFilter can be used to filter tests based on a regex and will apply the same regex to all potential candidates to see if it matches. This means that on a large test suite there could be measurable savings by using an overload which caches the regex.
I think it is much simpler than that. ExpectedValue is a constant initialized in the constructor.
Instead of using it as a string, we an create a (compiled) RegEx instance here and called IsMatch on that instance.
I find the IsRegEx property a bit weird. The pattern can't change type halfway through. Looking at its usages it is mainly used as an init property. In my opinion it should be changed to a constructor parameter.
This matches the pattern that is already used in StackFilter and RegexConstaint.
Thanks @manfred-brands ! That was exactly what I had been thinking too, right down to setting IsRegEx as a ctor param. Thanks for offering to take this on 😁
The static Regex functions internally cache parsed regex instances based on the provided pattern on .NET 5+. ValueMatchFilter can be used to filter tests based on a regex and will apply the same regex to all potential candidates to see if it matches. This means that on a large test suite there could be measurable savings by using an overload which caches the regex.
Something like this:
https://github.com/nunit/nunit/blob/master/src%2FNUnitFramework%2Fframework%2FInternal%2FFilters%2FValueMatchFilter.cs#L43
The text was updated successfully, but these errors were encountered: