[Async lightbulb performance] Move suppression fixes to 'Low' priority bucket#56959
[Async lightbulb performance] Move suppression fixes to 'Low' priority bucket#56959mavasani merged 5 commits intodotnet:mainfrom
Conversation
a715801 to
cdb9ac6
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
cdb9ac6 to
f2e3b8f
Compare
1236b74 to
928ccb4
Compare
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
Show resolved
Hide resolved
Addresses second item in dotnet#56843 Prior to this change, all the analyzers that are not high-pri are added to the normal priority bucket and executed at once. This PR further breaks down the normal priority bucket into two buckets as follow: 1. `Normal`: Analyzers that produce at least one fixable diagnostic, i.e. have a corresponding code fixer. 2. `Low`: Analyzers without any fixable diagnostics, i.e. have no corresponding code fixer. These diagnostics will only have Suppression/Configuration quick actions, which are lower priority and always show up at the bottom of the light bulb. This new bucketing allows us to reduce the number of analyzers that are executed in the Normal priority bucket and hence generate all the non-suppression/configuration code fixes faster in async light bulb.
d4ee79c to
0a2f5d7
Compare
|
@CyrusNajmabadi this should be ready for review |
src/EditorFeatures/Core.Wpf/Suggestions/AsyncSuggestedActionsSource.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Test/EditAndContinue/Helpers/MockDiagnosticAnalyzerService.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs
Outdated
Show resolved
Hide resolved
...es/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Outdated
Show resolved
Hide resolved
...es/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Outdated
Show resolved
Hide resolved
...es/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Show resolved
Hide resolved
...es/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/Diagnostics/IDiagnosticAnalyzerService.cs
Outdated
Show resolved
Hide resolved
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
overall i'm highly supportive of this. however, i think we shoudl takea slightly longer view and try to get this benefit without forcing the 'low' group only for suppressions. we have the 'low' concept today for many fixes and refactorings. Indeed, internally we have 'low' and 'lowest' (the latter is used for config/suppress). So i think we shoudl model the entire stack from top to bottom this way.
It will prevent a lot of confusing mismatches about which sort of 'low' we're talking about.
|
@CyrusNajmabadi Thanks for the feedback, I have addressed your comments, please take a look. |
590238c to
c75be31
Compare
c75be31 to
da34e59
Compare
...es/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Show resolved
Hide resolved
...rkspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeActions/CodeActionRequestPriority.cs
Show resolved
Hide resolved
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
nice. this got a lot cleaner. i like it. just some basic suggestions for clarity. tehre are some places that could use some comments to help with understanding.
|
Thank you for the review @CyrusNajmabadi! |
…edit/1450689) This regression was introduced with async lightbulb performance improvement PR: dotnet#56959. With that PR, we now optimize/reduce the number of analyzers to execute in the "Normal" priority bucket for async light bulb. We earlier executed all analyzers in this bucket, but now only try to execute analyzers which report at least one diagnostic ID which has a corresponding code fix provider that can fix that diagnostic ID. To identify this reduced set of analyzers, we execute this newly added perf optimization to skip analyzers that don't have a code fix: https://github.com/dotnet/roslyn/blob/88f829939583d49d9e08104a71a7645d712bcfbc/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs#L151-L155 `_owner.DiagnosticAnalyzerInfoCache.GetDiagnosticDescriptors` call in this code is problematic for TS analyzers, because these are not regular DiagnosticAnalyzer sub-types, but instead derive from our internal DocumentDiagnosticAnalyzer and ProjectDiagnosticAnalyzer types, and this analyzer lies to us and returns 0 supported diagnostic descriptors: https://github.com/dotnet/roslyn/blob/315c2e149ba7889b0937d872274c33fcbfe9af5f/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs#L16 and https://github.com/dotnet/roslyn/blob/315c2e149ba7889b0937d872274c33fcbfe9af5f/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptProjectDiagnosticAnalyzer.cs#L16. So, we skip TS analyzers for "Normal" priority bucket. This PR implements a short term fix to update the newly added code to special case DocumentDiagnosticAnalyzers and skip the newly added perf optimization for these analyzers. Note that ProjectDiagnosticAnalyzers are never executed in lightbulb/code fix path. I will create a separate issue to track designing a better long term solution for TS analyzers to avoid such breaking changes in future.
…edit/1450689) This regression was introduced with async lightbulb performance improvement PR: dotnet#56959. With that PR, we now optimize/reduce the number of analyzers to execute in the "Normal" priority bucket for async light bulb. We earlier executed all analyzers in this bucket, but now only try to execute analyzers which report at least one diagnostic ID which has a corresponding code fix provider that can fix that diagnostic ID. To identify this reduced set of analyzers, we execute this newly added perf optimization to skip analyzers that don't have a code fix: https://github.com/dotnet/roslyn/blob/88f829939583d49d9e08104a71a7645d712bcfbc/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs#L151-L155 `_owner.DiagnosticAnalyzerInfoCache.GetDiagnosticDescriptors` call in this code is problematic for TS analyzers, because these are not regular DiagnosticAnalyzer sub-types, but instead derive from our internal DocumentDiagnosticAnalyzer and ProjectDiagnosticAnalyzer types, and this analyzer lies to us and returns 0 supported diagnostic descriptors: https://github.com/dotnet/roslyn/blob/315c2e149ba7889b0937d872274c33fcbfe9af5f/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs#L16 and https://github.com/dotnet/roslyn/blob/315c2e149ba7889b0937d872274c33fcbfe9af5f/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptProjectDiagnosticAnalyzer.cs#L16. So, we skip TS analyzers for "Normal" priority bucket. This PR implements a short term fix to update the newly added code to special case DocumentDiagnosticAnalyzers and skip the newly added perf optimization for these analyzers. Note that ProjectDiagnosticAnalyzers are never executed in lightbulb/code fix path. I will create a separate issue to track designing a better long term solution for TS analyzers to avoid such breaking changes in future.
Addresses second item in #56843
Prior to this change, all the analyzers that are not high-pri are added to the normal priority bucket and executed at once. This PR further breaks down the normal priority bucket into two buckets as follow:
Normal: Analyzers that produce at least one fixable diagnostic, i.e. have a corresponding code fixer.Low: Analyzers without any fixable diagnostics, i.e. have no corresponding code fixer. These diagnostics will only have Suppression/Configuration quick actions, which are lower priority and always show up at the bottom of the light bulb.This new bucketing allows us to reduce the number of analyzers that are executed in the Normal priority bucket and hence generate all the non-suppression/configuration code fixes faster in async light bulb.