Skip to content

Update List of Assemblies to Crossgen#9635

Merged
marcpopMSFT merged 2 commits into
dotnet:masterfrom
brianrob:fix-crossgen
Feb 10, 2021
Merged

Update List of Assemblies to Crossgen#9635
marcpopMSFT merged 2 commits into
dotnet:masterfrom
brianrob:fix-crossgen

Conversation

@brianrob
Copy link
Copy Markdown
Member

@brianrob brianrob commented Feb 5, 2021

Contributes to dotnet/sdk#15558.

Context

The installer is responsible for precompiling the libraries that compose the final SDK. Over time, several new SDKs have been added, and several have been upgraded, which has resulted in a number of SDK assemblies that are not pre-compiled, and thus contribute to higher JIT times and overall wall-clock latency.

Changes Made

Updated paths to assemblies in crossgen.targets that contain assemblies that should be pre-compiled.

Testing

  • Verified that basic SDK scenarios work.
  • Captured before/after profiles to confirm wins.

Notes

This PR contains the following performance wins:

  • -548 drop in method jitting overall
  • 210.1ms improvement in JIT time (26.1%)
  • 7% improvement overall

I have filed #9634 to track work to catch this if/when it happens again.

cc: @stephentoub, @DamianEdwards, @marcpopMSFT

Copy link
Copy Markdown
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@brianrob
Copy link
Copy Markdown
Member Author

brianrob commented Feb 5, 2021

@pranavkm, this may improve some of the ASP.NET build scenarios you're looking at.

<RemainingFiles Include="$(SdkOutputDirectory)Sdks\NuGet.Build.Tasks.Pack\CoreCLR\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tasks\netcoreapp*\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tools\netcoreapp*\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tasks\net6.0\**\*" />
Copy link
Copy Markdown

@pranavkm pranavkm Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help if we put these in a netcoreapp directory? That way we wouldn't have to worry about updating these every major release. The TFM version isn't really useful to the SDK

/cc @captainsafia

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be worthwhile from a maintenance perspective. I suspect that we're going to need to do something to catch new additions to the SDK (likely a test that looks for new non-crossgen'd assemblies), and so it may not be immediately necessary, but if this validation becomes costly or difficult, then renaming the directory could be a good way to ensure that things don't break going forward.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not incredibly difficult to fix up the SDK to produce fixed paths, but I think adding a check would be a better approach.

@brianrob
Copy link
Copy Markdown
Member Author

brianrob commented Feb 8, 2021

@marcpopMSFT, can you recommend someone to review this please?

<RemainingFiles Include="$(SdkOutputDirectory)Sdks\NuGet.Build.Tasks.Pack\CoreCLR\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tasks\netcoreapp*\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tools\netcoreapp*\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tasks\net6.0\**\*" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not incredibly difficult to fix up the SDK to produce fixed paths, but I think adding a check would be a better approach.

Comment thread src/redist/targets/Crossgen.targets Outdated
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Publish\tools\netcoreapp*\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.ILLink.Tasks\tools\net5.0\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Publish\tools\net6.0\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\**\*" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Analyzers run in VS. Is this correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. If they run in VS, then probably not. I'll remove this one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be useful to multi-target these assemblies to allow the files to be crossgened? They appear in every compilation for a webapp

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a trace where these show up? It just depends on how much JIT time shows up.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should show up as part of Csc, but I don't have one off hand.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take a look at the amount of JIT time that comes from these, and report back. Thanks for pointing this out.

@marcpopMSFT marcpopMSFT requested a review from joeloff February 8, 2021 23:39
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Publish\tools\net6.0\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Web\tools\net6.0\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Web.ProjectSystem\tools\net6.0\**\*" />
<RemainingFiles Include="$(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Worker\tools\net6.0\**\*" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are oddly specific version folders

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason that the version is present is because many of these have a net472 version, and those should not get precompiled.

@joeloff
Copy link
Copy Markdown
Member

joeloff commented Feb 8, 2021

How much does this bloat the installer in terms of number of files/size?

@brianrob
Copy link
Copy Markdown
Member Author

brianrob commented Feb 9, 2021

@joeloff, this does not impact the number of files, it just precompiles files that are already included in the SDK. Here is a before and after comparison of size:

Zip File:

  • Before: 196MB
  • After: 211MB (+15MB / +7.7%)

Extracted:

  • Before: 545MB
  • After: 578MB (+33MB / +6.1%)

I would consider this a reasonable increase given the improvement that comes with it.

@joeloff
Copy link
Copy Markdown
Member

joeloff commented Feb 9, 2021

@brianrob I thought there might be more files, but the increase seems very reasonable. We're doing triage on Wednesday, okay if we merge then or is this blocking anything?

@brianrob
Copy link
Copy Markdown
Member Author

brianrob commented Feb 9, 2021

Not blocking. Wednesday is great. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants