-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Maximize usage of ImmutableCapabilities to further reduce memory usage and simplify code #23695
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tresat
force-pushed
the
tt/memory/immutable-capabilities
branch
from
January 28, 2023 15:29
d7c7693
to
144af84
Compare
tresat
changed the title
WIP: Immutability Experiment
Maximize usage of ImmutableCapabilities to further reduce memory usage and simplify code
Jan 28, 2023
…g unneeded instances of immutable types
@bot-gradle test this |
I've triggered the following builds for you: |
big-guy
approved these changes
Jan 30, 2023
@bot-gradle test and merge |
I've triggered a build for you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Makes
ImmutableCapabilities
class thoroughly immutable by verifying immutability of all contents as they are added. This add references to already immutable capabilities, and duplicates non-immutable capabilities as immutable types.Renames
DefaultShadowedCapability
toImmutableShadowedCapability
to advertise immutability. Also check that the shadowed capability is immutable upon construction, or make an immutable copy.The result of this is to make the
DefaultArtifactSelector
more efficient in two ways. It can defer creation of a fallback capabilities collection until it is actually needed. It can also reuse existing immutable capabilities rather than creating new instances, as the immutable types will never change.This saves 16MB or so during the large sync scenario testing by creating less
ImmutableCapabilities
andImmutableCapability
objects which are equivalent.The top image shows the new results, the bottom shows the old: