From e215988014f7740c2285179b8408a330dcf60d59 Mon Sep 17 00:00:00 2001 From: ewuerger Date: Fri, 12 Apr 2024 12:33:52 +0200 Subject: [PATCH] refactor: Performance improvement --- capellambse_context_diagrams/collectors/exchanges.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/capellambse_context_diagrams/collectors/exchanges.py b/capellambse_context_diagrams/collectors/exchanges.py index 4f34d517..f4eaab46 100644 --- a/capellambse_context_diagrams/collectors/exchanges.py +++ b/capellambse_context_diagrams/collectors/exchanges.py @@ -100,9 +100,9 @@ def make_ports_and_update_children_size( for child in data["children"]: inputs, outputs = [], [] obj = self.obj._model.by_uuid(child["id"]) + port_ids = {p.uuid for p in obj.inputs + obj.outputs} for ex in exchanges: source, target = ex["sources"][0], ex["targets"][0] - port_ids = [p.uuid for p in obj.inputs + obj.outputs] if source in port_ids: outputs.append(source) elif target in port_ids: @@ -215,6 +215,7 @@ def make_boxes( _inc_port_ids = set(ex.target.uuid for ex in outs) _out_port_ids = set(ex.source.uuid for ex in incs) _port_spread = len(_out_port_ids) - len(_inc_port_ids) + functions = get_capella_order(comp, functions) _functions = get_capella_order(_comp, _functions) if port_spread >= _port_spread: