Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dag_walk: heads: use bfs and terminate if frontier has single item
We use `heads_ok()` for finding the head operations when there are multiple current op heads. The current DFS-based algortihm needs to always walk all the way to the root. That can be expensive when the operations are slow to retrieve. In the common case where there are two operations close to each other in the graph, we should be able to terminate the search once we've reached the common ancestor. This patch replaces the DFS by a BFS and adds the early termination.
- Loading branch information