Skip to content

Commit

Permalink
refactor: Performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Apr 12, 2024
1 parent a23f5fe commit e215988
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion capellambse_context_diagrams/collectors/exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e215988

Please sign in to comment.