Aspnetcore: Investigate analyzer slowness

Created on 13 Jun 2019  路  15Comments  路  Source: dotnet/aspnetcore

I downloaded the latest preview 6, created a new project from default template and instantly noticed a massive difference in compiling time, I attach the difference in compile time Preview 5 vs Preview 6.

Preview 5 (less than 1 second)
P5

Preview 6 ( 8 seconds )
P6

I tried the latest VisualStudio Community Edition 16.1.3 and the Preview edition 16.2.0 Preview 2.0, and both behave the same, with the same issue.

I also downloaded the latest Preview 7 from daily builds (12386), and it behaves as Preview 6, I just didn't attach that gif capture.

I also installed and uninstalled the sdk & visual studio several times to discard install issues.

Regards!

Done External area-mvc bug

Most helpful comment

I thought it was just my machine. Guess not...

All 15 comments

I thought it was just my machine. Guess not...

Hmm, we did a bunch of SDK work in preview6. Maybe one of these is affect the build.

Does this reproduce at the command-line? Could either of you capture a binary log? /bl at the command line or using https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ProjectSystemTools in VS

@rynowak

Since no one else have attached a binary log, I'll do it :) This is a completely new project and I simply hit Build after making a small change. It took about 5 seconds. However on my actual project it takes around 8 seconds aswell.

msbuild.zip

@rynowak Any updates? :)

@kevinjpetersen could you edit your project file:

<PropertyGroup>
    <DisableImplicitAspNetCoreAnalyzers>true</DisableImplicitAspNetCoreAnalyzers>
</PropertyGroup>

and see if it helps? We added a couple of new analyzers recently and I think it's adding to the bulk of the compilation time.

@pranavkm Yes that helped significantly!

Is there any downside of disabling it? @pranavkm

We use analyzers as a way to provide build time guidance for correctness of code, so I'd certainly not recommend turning it off on a long term basis. But it should be perfectly fine to disable it until we get to the bottom of this

@NTaylorMullen perhaps this is the analyzer you wrote recently?

@NTaylorMullen perhaps this is the analyzer you wrote recently?

It's possible but we're not doing anything crazy in that analyzer. I'd definitely be surprised. I'll take a look quickly

So profiled this a bit and on a semi-slow VM for preview6 Blazor app running dotnet build --no-incremental

  • All MVC analyzers disabled: ~3.25s
  • All MVC analyzers enabled: ~7.75s

Disabled the new analyzer I added and there was 0 difference in performances. That being said, analyzers running almost doubling the build time doesn't seem great. @pranavkm is that expected?

Just confirming that I've reproduced this too and we definitely need to look into this. It's a massive difference (even more so in VS compared to the CLI).

@mkArtakMSFT I don't think this is anything specific to Blazor, it affects anything using the Web SDK it seems.

@NTaylorMullen I've moved this back to preview 8. Can you please prioritize this over the rest of Preview 8 work, as it seems this impacts the build performance - including our builds.

Investigated this and it looks to be an issue with Roslyn. When Analyzers are included in a users project their build server doesn't 100% fulfill a compilation requests at which point they fallback and start a new Csc process.

Logged an issue on their end with more details: https://github.com/dotnet/roslyn/issues/36963

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ipinak picture ipinak  路  3Comments

githubgitgit picture githubgitgit  路  3Comments

markrendle picture markrendle  路  3Comments

guardrex picture guardrex  路  3Comments

UweKeim picture UweKeim  路  3Comments