apache / apache/buildstream

Avoid repeated Element dependency graph traversal

Open
#2,176 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
140
Forks
45
Avg merge
1d 3h
Merged PRs (30d)
6

Description

`Element.__update_cache_keys()` may traverse the same `BUILD` dependency graph multiple times while calculating weak and strict cache keys.
PR #2172 reduces this locally by materializing the dependency list once and reusing it for both calculations, but `Element._dependencies()` could be cached with something like [`@functools.cache`](https://docs.python.org/3/library/functools.html#functools.cache).

Contributor guide

Open the contributing guide

Research direction

Start with Element.__update_cache_keys() and Element._dependencies(), then compare the local materialization approach in PR #2172 with Python's functools.cache documentation. Verify that the dependency graph is traversed only once while both weak and strict cache keys are calculated, without changing the resulting keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.