Skip to content

Commit aa64552

Browse files
authored
Use links_and_reverse_links_dict in replace_tasks (#824)
In b713497 we added a function to get both `links_dict` and `reverse_links_dict` in one go, avoiding iterating over the graph twice to build those. That function also benefits from being cached. I'm not expecting a big change in performance here but we might as well.
1 parent eed97a7 commit aa64552

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/taskgraph/optimize/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,9 @@ def replace_tasks(
297297

298298
opt_counts = defaultdict(int)
299299
replaced = set()
300-
dependents_of = target_task_graph.graph.reverse_links_dict()
301-
dependencies_of = target_task_graph.graph.links_dict()
300+
dependencies_of, dependents_of = (
301+
target_task_graph.graph.links_and_reverse_links_dict()
302+
)
302303

303304
for label in target_task_graph.graph.visit_postorder():
304305
logger.debug(f"replace_tasks: {label}")

0 commit comments

Comments
 (0)