coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

Cache the regexes used in InstrumentationHelper

Open xPaw opened this issue 5 months ago • 0 comments

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.

xPaw avatar Aug 26 '24 07:08 xPaw