In this case “frozenset” is good enough as the result's order doesn't
matter--it is the input to “sorted” (“utils.UniqueSequence” preserves
the order). “frozenset” is ca. 25% faster for this use-case.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
# they will still be there after, but this makes it a lot faster should
# just one of them be the already wrong. Using a sorted sequence to prevent
# deadlocks.
- for lname in sorted(utils.UniqueSequence(names)):
+ for lname in sorted(frozenset(names)):
try:
lock = self.__lockdict[lname] # raises KeyError if lock is not there
except KeyError: