Empty depsets should be optimized out of structs the same as they are optimized out of providers #19380
Labels
team-Starlark-Integration
Issues involving Bazel's integration with Starlark, excluding builtin symbols
team-Starlark-Interpreter
Issues involving the Starlark interpreter used by Bazel
type: feature request
untriaged
Description of the feature request:
Empty depsets are optimized out of providers, but not structs. This can lead to increased memory usage for some code patterns.
Which category does this issue belong to?
Starlark Integration, Starlark Interpreter
What underlying problem are you trying to solve with this feature?
In rules_xcodeproj we marshal a lot of data collected in aspects down the dependency tree. When doing Starlark memory profiling we noticed that creating new empty
depset
instances would drastically increase our memory usage. So instead we create frozen instances of empty values and use them when possible: https://github.com/MobileNativeFoundation/rules_xcodeproj/blob/31a9e114dac0e20625fb7d9119fe5a117ecb3608/xcodeproj/internal/memory_efficiency.bzl, which helped us reduce our memory usage.Which operating system are you running Bazel on?
macOS 13.4.1 (c)
What is the output of
bazel info release
?release 6.3.2
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
https://bazelbuild.slack.com/archives/CA31HN1T3/p1693484609534579 where @fmeum requested I open this issue.
The text was updated successfully, but these errors were encountered: