coverlet
coverlet copied to clipboard
Cache the regexes used in InstrumentationHelper
See #1689 for discussion. Currently for every invocation of these functions, a new Regex instance is created which is wasteful.
A quick fix that should work would be using static Regex.IsMatch
which caches them internally (up to 15 by default, so Regex.CacheSize may need to be tweaked).
Specifically IsValidFilterExpression, IsLocalMethod, IsTypeFilterMatch. The first two methods even have constant regex patterns.