Skip to content
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

Cache SDK resolver data process-wide #9335

Merged
merged 5 commits into from
Nov 1, 2023

Conversation

ladipro
Copy link
Member

@ladipro ladipro commented Oct 17, 2023

Fixes #9302

Context

Unless a shared evaluation context is used, each project evaluation creates a fresh new SdkResolverLoader, walks the disk to discover resolver manifests, calls Assembly.LoadFrom on resolver assemblies and so on. The cost of this is non-trivial (close to 3% of total evaluation time for solution like OrchardCore) while arguably there is no way how any of this can change while an MSBuild process is running.

Changes Made

  • Refactored the code to clean up unused parameters and changed several types from IList<> to IReadOnlyList<> to codify the fact that they are immutable.
  • Introduced CachingSdkResolverLoader as a subclass of SdkResolverLoader and plugged it into SdkResolverService.

Testing

Existing unit test and an experimental VS insertion.

Notes

Consider reviewing commit by commit.

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

Overall looks good.

I love the extra diligence in ensuring the encapsulation!!

@rainersigwald rainersigwald merged commit 34ae4f3 into dotnet:main Nov 1, 2023
8 checks passed
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.

[Performance]: 2.7% of evaluation is spent initializing SDK resolvers
4 participants