commit | 6a9394b5d1c4401679c87ff130fb8cf028439d08 | [log] [tgz] |
---|---|---|
author | Googler <jhorvitz@google.com> | Tue Apr 16 09:54:12 2024 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Apr 16 09:55:58 2024 -0700 |
tree | cf1d94cfa11e3d77d7e2ab638dd72fffdb8629e3 | |
parent | 76a214932da4a9dcf73d3cfe9313e0172d20e630 [diff] |
Reduce memory consumption of `TrieArtifact` in `ActionInputMap`. This can greatly reduce memory use when actions with many tree artifact inputs are in flight. Note that the memory use scales with the number of *unexpanded* tree artifacts - in other words, the cost is present even if each tree contains only one file. There are three optimizations: 1. Do not create a `TrieArtifact` node for the terminal tree artifact. This is now possible because nested tree artifacts are prohibited (special thanks to tjgq@). This helps both by reducing the total number of `TrieArtifact` instances and reducing the shallow heap cost of a single instance from 24 to 16 bytes (since the final `TreeArtifactValue` is stored directly in the map instead of in a field). 2. Intern path segment strings. 3. Use `CompactHashMap` instead of `HashMap`. Each of these optimizations yields significant benefit. This data structure was added in unknown commit as a way to efficiently look up the metadata of tree artifact children without storing the whole expansion. I've added some Javadoc to the class to justify its continued existence. PiperOrigin-RevId: 625365148 Change-Id: Ifa7d63decfacbaab060d907dfbda4531b0f0bea6
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Follow our tutorials:
To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.
See CONTRIBUTING.md