the rank() function uses list.index() to get the rank of any passed in domain. This causes a linear scan through the list until if finds the domain, which can take a long time if used to look up ranks for a large set of domains.
Instead you might build a dict[domain:rank] to hold the domain ranks. This way each rank lookup is a simple hashtable lookup.
the rank() function uses
list.index()
to get the rank of any passed in domain. This causes a linear scan through the list until if finds the domain, which can take a long time if used to look up ranks for a large set of domains.Instead you might build a dict[domain:rank] to hold the domain ranks. This way each rank lookup is a simple hashtable lookup.
If you want I can create a PR for you to do this.