In original function, a loop was used for counting the frequency of each element in the Distance. While use this function to C=CCCCCCCCCC(=O)[O-].[Na+], the times of loop can hit 100 millions.
Here I use the class Counter from collections instead of loop, which can significantly improve the efficient.
In original function, a loop was used for counting the frequency of each element in the
Distance
. While use this function to C=CCCCCCCCCC(=O)[O-].[Na+], the times of loop can hit 100 millions.Here I use the class
Counter
fromcollections
instead of loop, which can significantly improve the efficient.