roslyn: Very slow IntelliSense on relatively small code base


I’m not sure which process should be looked into for this case, devenv or ServiceHub.RoslynCodeAnalysisService.
GetSymbolInfo is commonly showing up as expensive in both:
ServiceHub.RoslynCodeAnalysisService:GetSymbolInfois called byNameSyntaxClassifier.AddClassificationdevenv:GetSymbolInfois called byCSharpSyntaxContext.CreateContextandCSharpTypeInferenceService+TypeInferrer.InferTypesWorker_DoNotCallDirectly.
If I clear GroupPats and FoldPats (which I read somewhere, but I don’t understand what they actually do), I see GetUseSiteInfo starts showing up.


About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 5
- Comments: 33 (32 by maintainers)
FWIW, it looks like there are a number of
CompletionProviderinstances invoked byCompletionService.GetCompletionsAsyncwhen typing.in the method, and theCompletionProviderinstances bind the modified method at least 4 times with distinctSemanticModelinstances, so there is no sharing ofBoundLambdainstances between those cases. Two of theCompletionProviderinstances are from Roslyn:If those two
CompletionProviderinstances could share aSemanticModel, at least when not using aSpeculativeSemanticModel, that might increase Intellisense perf slightly.cc @CyrusNajmabadi
It looks like typing
.in the Visual Studio editor results in binding the method body 10 times. It’s not clear how many of those method body bindings are required for displaying the completion list though.@jeromelaban I think it’s about shadowing, even if the code doesn’t have any methods that shadow others from base. It’s an algorithm that runs as part of the overload resolution:
https://github.com/dotnet/roslyn/blob/ef625f3b960594fcb3f902af88ad7c90df656516/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs#L250-L257
@cston Re-sent.