Also apply NestedSet optimizations to Depset#19379
Closed
fmeum wants to merge 1 commit intobazelbuild:masterfrom
Closed
Also apply NestedSet optimizations to Depset#19379fmeum wants to merge 1 commit intobazelbuild:masterfrom
NestedSet optimizations to Depset#19379fmeum wants to merge 1 commit intobazelbuild:masterfrom
Conversation
Collaborator
Author
|
@comius Could you review this? It's a memory optimization of the kind you have been doing a lot of recently. |
fmeum
commented
Aug 31, 2023
src/main/java/com/google/devtools/build/lib/collect/nestedset/Depset.java
Outdated
Show resolved
Hide resolved
comius
requested changes
Sep 6, 2023
src/main/java/com/google/devtools/build/lib/collect/nestedset/Depset.java
Outdated
Show resolved
Hide resolved
src/test/java/com/google/devtools/build/lib/collect/nestedset/DepsetTest.java
Show resolved
Hide resolved
64297d6 to
d581bef
Compare
comius
approved these changes
Sep 6, 2023
Collaborator
Author
|
@bazel-io flag |
Member
|
@bazel-io fork 6.4.0 |
Collaborator
Author
|
@comius Do you want me to resolve the merge conflicts or are you doing that in the imported change? |
Contributor
I’m not doing that. If you can resolve the conflicts that’s welcome. Thanks |
If the construction of a `NestedSet` involves only a single non-empty transitive set, this set may be returned directly as an optimization. This commit checks for this case when constructing a `Depset` and reuses the corresponding `Depset` if possible.
d581bef to
a1c7c08
Compare
Collaborator
Author
|
@comius Done |
iancha1992
pushed a commit
to iancha1992/bazel
that referenced
this pull request
Sep 11, 2023
If the construction of a `NestedSet` involves only a single non-empty transitive set, this set may be returned directly as an optimization. This commit checks for this case when constructing a `Depset` and reuses the corresponding `Depset` if possible. Since `Depset`s that are direct elements of providers are usually unwrapped into their `NestedSet`, this optimization only applies to instances stored in `struct`s as well as reduces allocations. Realizes an optimization proposed by @brentleyjones in https://bazelbuild.slack.com/archives/CA31HN1T3/p1693487067454409?thread_ts=1693484609.534579&cid=CA31HN1T3. Closes bazelbuild#19379. PiperOrigin-RevId: 563679197 Change-Id: I542bbf56784832768ca3bbbd550cc78bfb981ffe
iancha1992
added a commit
that referenced
this pull request
Sep 14, 2023
If the construction of a `NestedSet` involves only a single non-empty transitive set, this set may be returned directly as an optimization. This commit checks for this case when constructing a `Depset` and reuses the corresponding `Depset` if possible. Since `Depset`s that are direct elements of providers are usually unwrapped into their `NestedSet`, this optimization only applies to instances stored in `struct`s as well as reduces allocations. Realizes an optimization proposed by @brentleyjones in https://bazelbuild.slack.com/archives/CA31HN1T3/p1693487067454409?thread_ts=1693484609.534579&cid=CA31HN1T3. Closes #19379. Commit 216fce5 PiperOrigin-RevId: 563679197 Change-Id: I542bbf56784832768ca3bbbd550cc78bfb981ffe Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Member
|
The changes in this PR have been included in Bazel 6.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc. |
This file contains hidden or 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
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.
If the construction of a
NestedSetinvolves only a single non-empty transitive set, this set may be returned directly as an optimization. This commit checks for this case when constructing aDepsetand reuses the correspondingDepsetif possible.Since
Depsets that are direct elements of providers are usually unwrapped into theirNestedSet, this optimization only applies to instances stored instructs as well as reduces allocations.Realizes an optimization proposed by @brentleyjones in https://bazelbuild.slack.com/archives/CA31HN1T3/p1693487067454409?thread_ts=1693484609.534579&cid=CA31HN1T3.