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

Document how expensive Compilation.GetSymbolsWithName() is #7583

Open
aradalvand opened this issue Feb 16, 2025 · 1 comment
Open

Document how expensive Compilation.GetSymbolsWithName() is #7583

aradalvand opened this issue Feb 16, 2025 · 1 comment

Comments

@aradalvand
Copy link

aradalvand commented Feb 16, 2025

Some analyzers in the wild seem to use tricks like Compilation.GetSymbolsWithName(_ => true).Where(...) to lookup symbols that meet specific conditions relevant to their analyzer logic; the performance characteristics of this approach are unclear, it feels like it would force a full compilation upon each invocation, which if true, would mean it is suboptimal perf-wise, and should therefore be documented so as to discourage its use by performance-mindful analyzer authors.

@Youssef1313
Copy link
Member

I think this could be itself an analyzer part of Microsoft.CodeAnalysis.Analyzers package. There is already an analyzer for calling GetSemanticModel IIRC.

@jaredpar jaredpar transferred this issue from dotnet/roslyn Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants