Repository navigation
perf(roadmap): build the cycle graph once for each selection - #6534
Merged
Merged
Conversation
Plan the change that builds the dependency graph at most once for each stage and implement selection, and that gives a shortest cycle through the item with a breadth-first search.
Add the failing tests of #6516: a stage selection and an implement selection over several items with an open dependency build the graph once, a selection with no open dependency builds none, the path of an item is a shortest cycle, and a ring of 20,000 items gives its whole ring. The tests count the builds with sys.monitoring, so no test replaces a function.
open_dependency takes the dependency graph from its caller as a function that it calls only when a dependency is open. The stage and implement judges hold the graph of their items as a cached property, so a selection builds it at most once and builds none when no item has an open dependency (#6516). cycle_of searches only for the item that the caller asks for. The search is breadth-first with one parent for each item, so it gives a shortest cycle and copies no path at each step. The eager path of each open item, the cycles field and the graphlib gate go.
Apply the delta to roadmap-dependency-cycle. The strict validation asks for requirements of at most 500 characters, so the shortest-cycle rule is its own requirement.
Owner
Author
Check resultsHead commit:
Skipped check: Plan Check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The stage and implement judges built the graph of all open items again for each judged item with an open dependency. open_dependency now takes the graph from its caller as a function that it calls only when a dependency is open. Each judge holds its graph as a cached property, so a selection builds it at most once, and none when no dependency is open.
cycle_of now does a breadth-first search from the asked item with one parent for each item. It gives a shortest cycle and copies no path at each step.
devops roadmap explain 4814 over 807 open items: 47 graph builds (162 s) and 408 s in total before; 2 builds (8 s) and 266 s after, with the same output. Explain runs three selections, so it builds up to three graphs, not one as the proposed design of #6516 asked; design.md says why.
Closes #6516
Change:
openspec/changes/archive/2026-11-20-6516-build-the-cycle-graph-once/