Skip to content

Investigate analyzer slowness #11172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chrdlx opened this issue Jun 13, 2019 · 15 comments
Closed

Investigate analyzer slowness #11172

chrdlx opened this issue Jun 13, 2019 · 15 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed External This is an issue in a component not contained in this repository. It is open for tracking purposes.

Comments

@chrdlx
Copy link

chrdlx commented Jun 13, 2019

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!

@Eilon Eilon added the area-blazor Includes: Blazor, Razor Components label Jun 13, 2019
@SteveSandersonMS
Copy link
Member

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

@pranavkm
Copy link
Contributor

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

@rynowak
Copy link
Member

rynowak commented Jun 13, 2019

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

@kevinjpetersen
Copy link

@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

@kevinjpetersen
Copy link

@rynowak Any updates? :)

@pranavkm
Copy link
Contributor

@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.

@kevinjpetersen
Copy link

@pranavkm Yes that helped significantly!

@kevinjpetersen
Copy link

Is there any downside of disabling it? @pranavkm

@pranavkm
Copy link
Contributor

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

@pranavkm pranavkm changed the title ServerSide Blazor Preview 6 - Project compile time like 10x slower Investigate analyzer slowness Jun 18, 2019
@pranavkm
Copy link
Contributor

@NTaylorMullen perhaps this is the analyzer you wrote recently?

@NTaylorMullen
Copy link

@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

@NTaylorMullen
Copy link

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?

@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. PRI: 1 - Required and removed investigate labels Jun 19, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview8 milestone Jun 19, 2019
@DamianEdwards
Copy link
Member

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.

@mkArtakMSFT mkArtakMSFT added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates and removed area-blazor Includes: Blazor, Razor Components labels Jul 2, 2019
@mkArtakMSFT
Copy link
Contributor

@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.

@NTaylorMullen NTaylorMullen added Working External This is an issue in a component not contained in this repository. It is open for tracking purposes. labels Jul 3, 2019
@NTaylorMullen
Copy link

NTaylorMullen commented Jul 3, 2019

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: dotnet/roslyn#36963

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed External This is an issue in a component not contained in this repository. It is open for tracking purposes.
Projects
None yet
Development

No branches or pull requests

9 participants