aljpetri / isONform

De novo construction of isoforms from long-read data
GNU General Public License v3.0
14 stars 1 forks source link

Changing list to set #7

Closed ksahlin closed 10 months ago

ksahlin commented 12 months 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)

Also, if the order of path_list is not important, you should consider making it a set too, as the loop

    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

aljpetri commented 10 months ago

As the code that the issue applied to was deprecated and deleted from the repository in the meantime, I close the issue