Skip to content
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

Cache the regexes used in InstrumentationHelper #1693

Open
xPaw opened this issue Aug 26, 2024 · 0 comments
Open

Cache the regexes used in InstrumentationHelper #1693

xPaw opened this issue Aug 26, 2024 · 0 comments
Labels
enhancement General enhancement request Solved The issue is solved and can be closed

Comments

@xPaw
Copy link

xPaw commented Aug 26, 2024

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.

@github-actions github-actions bot added the untriaged To be investigated label Aug 26, 2024
@Bertk Bertk added enhancement General enhancement request Solved The issue is solved and can be closed and removed untriaged To be investigated labels Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General enhancement request Solved The issue is solved and can be closed
Projects
None yet
Development

No branches or pull requests

2 participants