Skip to content

reduce redundant artifact, CAS, and cache-key work - #2172

Open
kotborealis wants to merge 3 commits into
apache:masterfrom
kotborealis:perf/cache-cas-optimizations
Open

reduce redundant artifact, CAS, and cache-key work#2172
kotborealis wants to merge 3 commits into
apache:masterfrom
kotborealis:perf/cache-cas-optimizations

Conversation

@kotborealis

Copy link
Copy Markdown
Contributor

This change removes redundant work from artifact creation, remote CAS directory fetching, and cache-key calculation:

  • Remove the unused recursive artifact size calculation.
  • Avoid issuing a second FetchTree request in CASCache.fetch_directory().
  • Reuse the build dependency list when calculating weak and strict cache keys.

Comment thread src/buildstream/element.py
@kotborealis

Copy link
Copy Markdown
Contributor Author

The failed CI jobs are all failing for the same unrelated reason.

bst init still uses 2.7 as the default --min-version in src/buildstream/_frontend/cli.py:423, while the build is detected as BuildStream 2.8.0.dev0.

@nathanwilliams-ct

Copy link
Copy Markdown
Contributor

The failed CI jobs are all failing for the same unrelated reason.

bst init still uses 2.7 as the default --min-version in src/buildstream/_frontend/cli.py:423, while the build is detected as BuildStream 2.8.0.dev0.

#2175 Fixes this.

@nathanwilliams-ct

Copy link
Copy Markdown
Contributor

The failed CI jobs are all failing for the same unrelated reason.
bst init still uses 2.7 as the default --min-version in src/buildstream/_frontend/cli.py:423, while the build is detected as BuildStream 2.8.0.dev0.

#2175 Fixes this.

PR merged, you should be able to rebase the branch for a happy CI.

Artifact.cache() already stores the collected directory digest and never uses the recursive size calculation that follows it. Remove the dead accumulator and _get_size() call so artifact creation does not walk the output tree a second time.
fetch_directory() has already fetched the directory protos with FetchTree before enumerating required blobs. Tell required_blobs_for_directory() to reuse those local protos instead of issuing another FetchTree request, reducing remote CAS round trips.
Weak and strict cache keys both consume the same build dependency list. Materialize the generator once and reuse it so cache-key updates do not traverse the dependency graph twice while preserving the existing key inputs and ordering.
@kotborealis
kotborealis force-pushed the perf/cache-cas-optimizations branch from dc65f9c to 857681c Compare August 17, 2026 13:40
Comment thread src/buildstream/_cas/cascache.py

@abderrahim abderrahim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'd prefer @juergbi take another look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants