dotnet / platform-compat

Roslyn analyzer that finds usages of APIs that will throw PlatformNotSupportedException on certain platforms.
MIT License
279 stars 43 forks source link

High build time performance impact #202

Open nphmuller opened 5 years ago

nphmuller commented 5 years ago

I really like this package, but the build time impact at the moment is simply to high for me to use it.

On version 0.2.12-alpha: Without: ~10 sec With: ~30 sec

There doesn't seem to be an analyzer that I can single out that's responsible for the time impact. I've tried disabling all analyzers except DE0001, and all analyzers except PC001, but the build time still seems to be about 30 sec.

chucker commented 5 years ago

I can't reproduce this build time impact on a fresh empty ASP.NET Core 3.0 project.

Can you give some more specifics how your solution is set up?

nphmuller commented 5 years ago

@chucker I can't share our application code, but I've created a repro with a db model size and db migration count of about the same as in our application.

git clone https://github.com/nphmuller/AnalyzerPerformanceIssue.git
cd AnalyzerPerformanceIssue

# Takes about 4 sec on my machine
dotnet restore && dotnet clean && dotnet build --no-restore

# Now it takes about 9 sec on my machine.
dotnet add package Microsoft.DotNet.Analyzers.Compatibility --version 0.2.12-alpha
dotnet restore && dotnet clean && dotnet build --no-restore
jnm2 commented 5 years ago

This analyzer is adding 6.4 seconds (an additional 116%) to the build time in our most common scenario. I need to prioritize our developers' trains of thought when making a change and rerunning tests, and this extra time makes a material difference.