-
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
Allow optional reuse of existing immutable collections when constructing a ProjectInstance. #9374
Allow optional reuse of existing immutable collections when constructing a ProjectInstance. #9374
Conversation
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.
Looks correct. However, it is hard for me to understand its full context as I don't known how exactly it will be usable for CPS.
However, it is lot of changes, as there is no unit teste coverage for those, how did you verified it?
src/Build/Collections/RetrievableEntryHashSet/IRetrievableEntryHashSet.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableElementCollectionConverter.cs
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableElementCollectionConverter.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableElementCollectionConverter.cs
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableElementCollectionConverter.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableItemDictionary.cs
Outdated
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.
I agree with @rokonec that it would be useful to describe the intended usage patterns.
Also, seeing several concrete types converted to interfaces, it would be good to verify that there are no perf regressions as interface calls are generally slower and on some of the hot evaluation code paths it may be measurable. I can help with the measurements.
src/Build/Instance/ImmutableProjectCollections/ImmutableElementCollectionConverter.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableElementCollectionConverter.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableItemDictionary.cs
Outdated
Show resolved
Hide resolved
src/Build/Instance/ImmutableProjectCollections/ImmutableItemDictionary.cs
Outdated
Show resolved
Hide resolved
@rokonec - CPS tests and manual verification of impacted scenarios. If there are additional steps I can take to verify please let me know. :) |
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.
Looks good to me, thank you!
@sgreenmsft - can you please resolve comments that were reflected or doesn't apply anymore? That will make the second look easier. Plus please resolve the conflicts with main. @rokonec - can you please have a second look if your concerns were addressed? |
Seems to be OK. |
ProjectInstance is a snapshot of the Project values that duplicates the project data in "Instance" objects (e.g. ProjectPropertyInstance). In the special case of the ProjectInstance constructed from the CPS Evaluation Cache data, this duplication is unnecessary, as the original data is guaranteed to be immutable. This PR introduces the ProjectInstance.FromImmutableProjectSource method, which CPS will use when it wants ProjectInstance to reuse its immutable structures.
One complicating factor was a concern about taking a dependency on any particular version of MSBuild, as CPS ships in C# Dev Kit and in that context it must play nice with the installed version.