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

Further cleanup and code reduction in analyzer driver. #76921

Draft
wants to merge 50 commits into
base: main
Choose a base branch
from

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Jan 25, 2025

Followup to #76917

Primary changes are making lambdas explicitly static to ensure they never accidentally capture state, and making a new helper structure to capture many parameters taht are passed along to so many methods in these codepaths.

ToddGrun and others added 30 commits January 23, 2025 15:10
In the scrolling speedometer test, the Roslyn CodeAnalysis process shows about 25% of CPU spent in this method. Of that, a surprising amount of it (11.2%) is spent in ImmutableSegmentedDictionary.TryGetValue. Debugging through this code, it appears this is because that is called O(m x n) times where m is the number of nodes to analyze and n is the number of items in groupedActions.GroupedActionsByAnalyzer.

Instead, add a hook into GroupedAnalyzerActions to allow a mapping of kind -> analyzers. This can be used by executeNodeActionsByKind to get a much quicker way to determine whether the analyzer can contribute for the node in question.

Only publishing this early so Cyrus can take a peek, as I still need to do a bit of debugging around these changes. Once Cyrus and I think the changes have merit, I will create a test insertion and publish the speedometer results once those are available. Only if all that goes well will I promote this PR out of draft mode.
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 25, 2025
@CyrusNajmabadi CyrusNajmabadi changed the title Fruther cleanup and code reduction in analyzer driver. Further cleanup and code reduction in analyzer driver. Jan 25, 2025
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review January 28, 2025 00:04
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner January 28, 2025 00:04
@CyrusNajmabadi CyrusNajmabadi marked this pull request as draft January 28, 2025 00:04
@CyrusNajmabadi
Copy link
Member Author

Ignore that. I pinged the wrong PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants