-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize shallow heap of
LibraryToLinkValue
.
Currently the shallow heap size is `32` bytes (`12` bytes for the `Object` header, `1` boolean field, and `3` reference fields => `12 + 1 + 3*4 = 25`, which rounds up to `32`, the next multiple of `8`). But the 6 different factory methods don't actually need all those fields. Instead, we can save shallow heap by using a class hierarchy to encode information. For a large Bazel invocation with ~1M `LibraryToLinkValue` instances this CL saves ~16MB in the common situation where calls to `#forObjectFileGroup` are uncommon. While I was here I wrote unit tests for `LibraryToLinkValue` so that the next person who looks at the `#getFieldValue` business logic can more easily make changes. PiperOrigin-RevId: 432471316
- Loading branch information
1 parent
c1db56c
commit ae41448
Showing
3 changed files
with
646 additions
and
89 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
Oops, something went wrong.