Avoid repeated Element dependency graph traversal

Open
#2,176 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

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.

Dominant language
Python
Stars
144
Forks
45
Avg merge
20h 38m
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/buildstream

All issues in apache/buildstream

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.