forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize storage of output files in
Rule
.
* Store the `outputKey` in `OutputFile` because it costs nothing extra to do so (2 fields vs 3 fields both 24 bytes). This removes storage of the `outputKey` string in `flattenedOutputFiles`, reducing the size of the list. * Encode whether output files are explicit in the class type so that we don't need to store an `int` counting the number of implicit outputs in `Rule`. Removing the `int` field reduces the shallow heap size of `Rule` by 8 bytes. * Optimize for the common case of a rule with a single output file by storing it bare. Also forego `ImmutableList` wrappers in favor of `OutputFile[]`. I thought about making `Rule` immutable with subclasses for the different number of output files, but that would require some major refactoring. PiperOrigin-RevId: 518961414 Change-Id: I03d8ff4d883f2e2ea4468e150b2081a293eb14af
- Loading branch information
1 parent
50e5e6c
commit 2aee015
Showing
2 changed files
with
118 additions
and
96 deletions.
There are no files selected for viewing
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
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