-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support lazy instantiation of ProjectInstance values when CPS Evaluation cache is used #10030
Conversation
…le data source (the evaluation cache).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First quick pass
src/Build/Collections/RetrievableEntryHashSet/RetrievableValuedEntryHashSet.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableGlobalPropertiesCollectionConverter.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, leaving a few minor comments inline. An experimental VS insertion is in progress here.
src/Build/Collections/RetrievableEntryHashSet/IRetrievableValuedEntryHashSet.cs
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableItemDictionary.cs
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableStringValuedListConverter.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableItemDefinitionsListConverter.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableGlobalPropertiesCollectionConverter.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableGlobalPropertiesCollectionConverter.cs
Outdated
Show resolved
Hide resolved
@sgreenmsft, Speedometer is reporting broken tests (internal link), can you please take a look? |
Thank you for getting these results! 🙂 I checked and it turns out that those errors are a known infrastructure issue and the guidance is to ignore them. The ICM incident is linked under "1 active outage" in the Speedometer result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me.
… Evaluation cache is used (dotnet#10030)" This reverts commit eade720.
…S Evaluation cache is used (dotnet#10030)" (dotnet#10205) This reverts commit 9bea802.
…emory issue. (#10354) * Revert "Support lazy instantiation of ProjectInstance values when CPS Evaluation cache is used (#10030)" This reverts commit eade720. * wip * Reapply "Support lazy instantiation of ProjectInstance values when CPS Evaluation cache is used (#10030)" (#10205) This reverts commit 9bea802.
… Evaluation cache is used (#10350) * Revert "Support lazy instantiation of ProjectInstance values when CPS Evaluation cache is used (#10030)" This reverts commit eade720. * wip * Reapply "Support lazy instantiation of ProjectInstance values when CPS Evaluation cache is used (#10030)" (#10205) This reverts commit 9bea802. --------- Co-authored-by: Jan Krivanek <jankrivanek@microsoft.com>
Context
This PR targets the specific scenario of constructing a ProjectInstance object from the evaluation data stored in CPS's evaluation cache, with the goal of saving memory and execution time during Solution Load.
In a previous change (2a789cd), I modified the ProjectInstance logic to rely on virtualized collections that are wrappers around the CPS evaluation cache's collection. The ProjectPropertyInstance, ProjectItemInstance, etc. objects were created ahead of time and associated with the corresponding CPS object, such that only one copy of the collections needed to exist.
In this PR, the goal is to extend that further such that the ProjectPropertyInstance, ProjectItemInstance, etc. values are only created when they're actually needed, and some new logic is introduced for reading Property values and Metadata values that allows avoiding creating the ProjectPropertyInstance and ProjectMetadataInstance when all that's sought is the EscapedValue string.
Changes Made
The collections for ProjectInstance's _properties, _itemDefinitions, _items, _itemsByEvaluatedInclude, _globalProperties, _targets, _importPaths, and _importPathsincludingDuplicates collections are replaced with specialized virtualizing collections that wrap the associated CPS collection. These collections create the ProjectPropertyInstance et al objects only when a caller requests them. Additionally, the ProjectItemDefinitionInstance's metadata collection, and the ProjectItemInstance's ItemDefinition and Metadata collections are all similarly replaced by a virtualizing collection.
ProjectInstance's _environmentVariableProperties still relies on the ProjectCollection's EnvironmentVariables, but a new SharedReadOnlyEnvironmentProperties collection is introduced that does not hand out copies of the PropertyDictionary, but instead the same PropertyDictionary instance whose backing collection has been made read only.
Testing
Manual verification of impacted scenarios and performance measurements.