Skip to content
Snippets Groups Projects
Commit a13d34a6 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

locking: Use frozenset instead of utils.UniqueSequence


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: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0ef4d576
No related branches found
No related tags found
No related merge requests found
......@@ -1191,7 +1191,7 @@ class LockSet:
# 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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment