From 83d6f4b2df8f579f97a91baeacdd2c250529c6e7 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 30 Jun 2026 07:07:03 +0200 Subject: [PATCH] App.__find_circular_deps(): Move __flip_dep_graph() out The __flip_dep_graph(graph) call sits inside the while loop and performs redundant graph flipping on every iteration. Hoist it outside to compute once and reuse the result. Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev Signed-off-by: Jan Lindemann --- src/python/jw/pkg/App.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/jw/pkg/App.py b/src/python/jw/pkg/App.py index 03fb3f7b..7d93af61 100644 --- a/src/python/jw/pkg/App.py +++ b/src/python/jw/pkg/App.py @@ -319,11 +319,12 @@ class App(Base): self.__read_dep_graph(projects, flavours, graph) unvisited = list(graph.keys()) temp: set[str] = set() + flipped = self.__flip_dep_graph(graph) while unvisited: project = unvisited[0] log(DEBUG, 'Checking circular dependency of', project) last = self.__find_circular_deps_recursive( - project, self.__flip_dep_graph(graph), unvisited, temp, ret + project, flipped, unvisited, temp, ret ) if last is not None: log(DEBUG, f'Found circular dependency below {project}, last is {last}')