dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.96k stars 4.02k forks source link

Detect SourceGenerator slowness and notify users to disable #55580

Open NTaylorMullen opened 3 years ago

NTaylorMullen commented 3 years ago

Background and Motivation

I've discussed a lot of the background for this issue in these two issues:

Solution

@jmarolf mentioned that we already have APIs to notify users in VS when classical analyzers are slow. SourceGenerators have a similar impact so we need to have a mechanism to detect slow source generators and notify users.

@jmarolf would you mind sharing the pre-existing experience for Analyzers so we can understand how we can propagate this to SGs?

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

sharwell commented 3 years ago

mentioned that we already have APIs to notify users in VS when classical analyzers are slow

I don't believe this is the case.

jmarolf commented 3 years ago

I don't believe this is the case.

I was referring to /p:ReportAnalyzer=true from here which is not an API, but is the best mechanism we have today to track analyzer performance in a build.

sharwell commented 3 years ago

Ah, that covers build performance for analyzers. We should include something similar for source generators, but in most cases the numbers produced by that will not accurately represent the experience inside the IDE for the same analyzers (the build runs source generators in a non-incremental fashion today, which is very different from the behavior while typing).

jmarolf commented 3 years ago

True, we may want to add something in https://github.com/dotnet/project-system-tools to allow us to track incremental performance. We currently have https://github.com/dotnet/project-system-tools/blob/main/src/ProjectSystemTools/RoslynLogging/RoslynWorkspaceStructureLogger.cs for a similar purpose.

jasonmalinowski commented 2 years ago

https://github.com/dotnet/roslyn/pull/60267 is now out to let us capture data; we won't get that wired up until 17.3 though.

jasonmalinowski commented 2 years ago

(or at least, we won't have it fully wired up such that we can call this closed)