Avoid repeated Element dependency graph traversal
- 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
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