list_of_name_tuples_1 = [('a', 'aa'), ('b', 'bbb'), ('c', 'cc', 'ccc')]
list_of_name_tuples_2 = [('a', 'AA'), ('b', 'BBB'), ('c', 'cc', 'CCC')]
name_sets_1 = [set(i) for i in list_of_name_tuples_1]
name_sets_2 = [set(i) for i in list_of_name_tuples_2]
overlap = {}
for l1, s1 in zip(list_of_name_tuples_1, name_sets_1):
    for l2, s2 in zip(list_of_name_tuples_2, name_sets_2):
        overlap[l1, l2] = len(s1 & s2)
Как ускорить 4 миллиона заданных перекрестков?