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 reference assemblies between tests to improve performance #71

Conversation

MattKotsenas
Copy link
Collaborator

The testing framework does a bunch of heavy lifting to resolve references for set of ReferenceAssemblies, including potentially running the NuGet client to download packages. This class caches the ReferenceAssemblies class (which is thread-safe), so that package resolution only happens once for a given configuration.

The is the same approach taken by https://github.com/dotnet/roslyn-analyzers/blob/4d5fd9da36d64d4c3370b8813122e226844fc6ed/src/Test.Utilities/AdditionalMetadataReferences.cs.

This cuts test time from ~40 seconds to ~20 seconds on my machine.

@rjmurillo rjmurillo merged commit 5c29516 into rjmurillo:main Jun 7, 2024
4 checks passed
@rjmurillo
Copy link
Owner

Nice!

@rjmurillo rjmurillo self-assigned this Jun 7, 2024
@rjmurillo rjmurillo added this to the vNext milestone Jun 7, 2024
@MattKotsenas MattKotsenas deleted the refactor/test-perf-reference-assemblies branch June 7, 2024 20:30
@MattKotsenas
Copy link
Collaborator Author

I also opened a PR to update the test docs to make this clearer: dotnet/roslyn-sdk#1160

@MattKotsenas
Copy link
Collaborator Author

This addresses part of #64.

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

Successfully merging this pull request may close these issues.

2 participants