Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also apply
NestedSet
optimizations to Depset
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. PiperOrigin-RevId: 563679197 Change-Id: I542bbf56784832768ca3bbbd550cc78bfb981ffe
- Loading branch information