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

RAR: Don't load per project disk cache when not needed #8635

Closed
Tracked by #8422
ladipro opened this issue Apr 5, 2023 · 1 comment
Closed
Tracked by #8422

RAR: Don't load per project disk cache when not needed #8635

ladipro opened this issue Apr 5, 2023 · 1 comment

Comments

@ladipro
Copy link
Member

ladipro commented Apr 5, 2023

This issue tracks implementing the optimization per https://github.com/dotnet/msbuild/blob/main/documentation/specs/rar-core-scenarios.md#dont-load-the-per-project-disk-cache-when-not-needed

Parent user story: #8422

The on disk cache is not adding any value in the hot scenario because its contents already lives in the in-memory cache. The proposal is to load it lazily only when (and if) RAR runs into an assembly that does not have a record in the in-memory cache. In developer inner loop, when the same solution is built over and over again, the cache would typically not be loaded at all, unless the developer makes a change that actually changes the dependency graph.

@ladipro ladipro self-assigned this May 2, 2023
JaynieBai pushed a commit that referenced this issue Jun 12, 2023
Contributes to #8635

Context
With #8688 we no longer need to cache data on immutable framework files on disk as obtaining this information is cheap and does not require I/O.

Changes Made
Made SystemState (the RAR cache) not add such files to the per-instance dictionary. This dictionary is serialized to disk as <project-file>.AssemblyReference.cache so the change effectively makes the cache file smaller, saving on serialization and deserialization time.

Also refactored DeserializeCache into a generic method instead of taking a Type parameter.

For a simple ASP.NET Core app with one project reference and one package reference, the size of the cache file is reduced from 142 kB to 2 kB. Projects with no references other than the SDK will not have the cache file created at all.

Testing
Existing unit tests, manual measurements.

Notes
The actual "Don't read the file if the data is already in memory" change will be in a separate upcoming PR.
@ladipro
Copy link
Member Author

ladipro commented Jun 19, 2023

Closing as this work has not proven impactful enough. Details in #8901.

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

Successfully merging a pull request may close this issue.

2 participants