-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
filter references for satellite assembly generation down to just the primary assemblies #38504
Conversation
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
To test this I need to be able to assert on the values of Items, which the current test framework doesn't support. #38811 tracks expanding the framework to support that. Will come back to this when I can green it up. |
@davidwrighton and @agocke assured me that this approach is runtime approved. What do we need to do in order to hit the submit button here? |
It needs to be cleaned up to not leak like @KalleOlaviNiemitalo mentioned, and it needs tests. My main problem is I have a bunch of other work that needs doing, so I probably need to get someone from the team to help get this over the line. @dotnet/domestic-cat maybe this would be a great one to focus on in-between codeflow/triage? Also needs rebasing onto 8.0.4xx. |
src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExe.cs
Outdated
Show resolved
Hide resolved
b7829fe
to
a4aa210
Compare
Quick analysis from an actual Roslyn insertion:
|
Fixes #38478.
Satellite assemblies have a very constrained dependency list - essentially just the 'primary assembly' for the runtime platform being compiled for. This means one of mscorlib, netstandard, or System.Runtime. We currently pass the entire set of reference assemblies to the Csc Task when generating satellite assemblies, which means that the Roslyn compiler has to spend quite a bit of time on reference metadata reads, often evicting other more useful assemblies from the Roslyn compiler server's caches.
We can take advantage of this constrained generation domain to limit the set of references passed to the compiler invocation to just the 'primary assemblies', which should save quite a lot of time in aggregate.
Results
On my machine, for each 'cluster' of CSC invocations for satellite assemblies during the Roslyn build, the first call took ~800ms, and subsequent calls took ~75ms. After this change, the numbers are ~6ms and ~4ms respectively.
Aggregated across a single run of the Roslyn solution on my machine, I get
quick F# Interactive script to grab out the duration of satellite assembly generation from a before.binlog and after.binlog file in the current directory