Closed ksahlin closed 1 year ago
I think you can make already_merged to a set to avoid O(n) complexity in if rtup2 not in already_merged: (thus cubic runtime in the loop)
already_merged
if rtup2 not in already_merged:
Also, if the order of path_list is not important, you should consider making it a set too, as the loop
path_list
for merged_elem in already_merged: path_list.remove(merged_elem)
is O(n^2) in complexity since removing things from a list is linear, while removing items from a set is cheap.
In practice I don't know whether this affects runtime at all.
relevant part of code: https://github.com/aljpetri/isONform/blob/2791850f18126f372f8af8bf849a04a1302e0761/modules/SimplifyGraph.py#L797C5-L797C21
As the code that the issue applied to was deprecated and deleted from the repository in the meantime, I close the issue
I think you can make
already_merged
to a set to avoid O(n) complexity inif rtup2 not in already_merged:
(thus cubic runtime in the loop)Also, if the order of
path_list
is not important, you should consider making it a set too, as the loopis O(n^2) in complexity since removing things from a list is linear, while removing items from a set is cheap.
In practice I don't know whether this affects runtime at all.
relevant part of code: https://github.com/aljpetri/isONform/blob/2791850f18126f372f8af8bf849a04a1302e0761/modules/SimplifyGraph.py#L797C5-L797C21