Author: Maciej Fijalkowski <[email protected]>
Branch: 
Changeset: r65136:588a9d71f1d6
Date: 2013-07-01 15:32 +0200
http://bitbucket.org/pypy/pypy/changeset/588a9d71f1d6/

Log:    a fast path for set equality (note that if len(s1) == len(s2), then
        s1.issubset(s2) -> s1 == s2)

diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -944,9 +944,11 @@
         if w_set.length() == 0:
             return True
         # it's possible to have 0-lenght strategy that's not empty
-        items = self.unerase(w_set.sstorage).keys()
+        if w_set.strategy is w_other.strategy:
+            return self._issubset_unwrapped(w_set, w_other)
         if not self.may_contain_equal_elements(w_other.strategy):
             return False
+        items = self.unerase(w_set.sstorage).keys()
         for key in items:
             if not w_other.has_key(self.wrap(key)):
                 return False
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to