-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Revert "Revert "reduce memory allocation when a project instance is created from immutable project cache state"" #12513
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
Conversation
…reated f…" This reverts commit da45290.
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.
the regression turned out to be unrelated despite having similar names to concepts changed in this pr
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.
Pull Request Overview
This PR reverts the revert of memory allocation optimizations when creating ProjectInstance from immutable project cache state. The primary purpose is to reduce memory usage during project instance creation by introducing lazy-loading patterns and more efficient collection converters.
Key changes include:
- Introduces
LazyStringValuedListfor deferred string list initialization - Implements
ImmutableProjectMetadataCollectionConverterandImmutableProjectPropertyCollectionConverterfor optimized collection handling - Updates
TranslatorHelpers.csto supportIReadOnlyDictionary<string, string>parameters
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/Shared/TranslatorHelpers.cs |
Adds new overload for translating IReadOnlyDictionary<string, string> and refactors existing ImmutableDictionary method to use the new implementation |
src/Build/Microsoft.Build.csproj |
Updates project file to include new collection converter classes and removes old converter implementations |
src/Build/Instance/ProjectItemInstance.cs |
Changes metadata storage from ImmutableDictionary to IReadOnlyDictionary with lazy conversion and optimized property access |
src/Build/Instance/ProjectInstance.cs |
Implements lazy import path loading and optimized property collection handling for immutable project sources |
src/Build/Instance/ImmutableProjectCollections/LazyStringValuedList.cs |
New class implementing lazy-initialized, immutable string list for import paths |
src/Build/Instance/ImmutableProjectCollections/ImmutableProjectPropertyCollectionConverter.cs |
New converter for optimized property collection handling with direct value retrieval |
src/Build/Instance/ImmutableProjectCollections/ImmutableProjectMetadataCollectionConverter.cs |
New converter for metadata collections with lazy dictionary conversion |
src/Build/Instance/ImmutableProjectCollections/ImmutableGlobalPropertiesCollectionConverter.cs |
Enhanced with IValueDictionaryConverter interface support |
src/Build/Collections/RetrievableEntryHashSet/IRetrievableUnescapedValuedEntryHashSet.cs |
New interface for direct unescaped value retrieval without object allocation |
src/Build/Collections/PropertyDictionary.cs |
Enhanced with unescaped value retrieval and read-only dictionary conversion |
src/Build/Collections/IValueDictionaryConverter.cs |
New interface for specialized property dictionaries |
| Test files | Multiple test files implementing mock objects for testing the new functionality |
src/Build/Instance/ImmutableProjectCollections/ImmutableProjectMetadataCollectionConverter.cs
Show resolved
Hide resolved
Yes, it was proved that these changes didn't caused the regression. |
Reverts the revert of #12510 :) Original PR #12249