-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Also apply NestedSet optimizations to Depset
#19379
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
|
@comius Could you review this? It's a memory optimization of the kind you have been doing a lot of recently. |
src/main/java/com/google/devtools/build/lib/collect/nestedset/Depset.java
Outdated
Show resolved
Hide resolved
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
|
@bazel-io flag |
|
@bazel-io fork 6.4.0 |
|
@comius Do you want me to resolve the merge conflicts or are you doing that in the imported change? |
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
|
@comius Done |
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
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 <[email protected]>
|
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. |
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.