If you want to get a counter that ignores order, use frozenset with a counter:
from collections import Counter print(Counter(map(frozenset, y)))
Using tuples from another answer:
In [9]: len(tuples) Out[9]: 500000 In [10]: timeit Counter(map(frozenset, tuples)) 1 loops, best of 3: 582 ms per loop
Using frozenset will mean (1, 2) and (2,1) will be considered the same:
In [12]: y = [(1, 2), (2, 3), (1, 2), (5, 6),(2, 1),(6,5)] In [13]: from collections import Counter In [14]: In [14]: print(Counter(map(frozenset, y))) Counter({frozenset({1, 2}): 3, frozenset({5, 6}): 2, frozenset({2, 3}): 1})
If you apply the same logic using multiprocessing, it will obviously be significantly faster, even if it does not exceed what was provided using multiprocessing.