-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex.IsMatch(string, string) inside NamingSettings.ctor is causing 15.1% allocations #3629
Comments
How do you actually measure this please? I would love to measure impact of an analyzer of mine but I'm not sure how to do it. |
Building a large .cs project, capturing a trace using PerfView. This stack is bad enough that any trace invoking it will show. |
My understanding was that Regex.IsMatch caches the instance, but maybe the cache isn't big enough for everything needed while compiling a large solution. I am having problems actually measuring this, but changing to having a static field with the Regex instead of calling Regex.IsMatch seems trivial. Do you see any downsides to that, @sharwell? Or maybe rewrite to not use a Regex at all, since the pattern is so simple? |
…tance instead of calling Regex.IsMatch DotNetAnalyzers#3629
…tance instead of calling Regex.IsMatch DotNetAnalyzers#3629
Building a large project, found Regex.IsMatch(string, string) inside NamingSettings.ctor is causing 15.1% allocations, mostly due to constructing regular expression repeatitively. At least the regular expressions should be reused.
The text was updated successfully, but these errors were encountered: