[pypy-commit] pypy set-strategies: when updating empty list simply copy storage and strategy from the other set

l.diekmann noreply at buildbot.pypy.org
Thu Nov 10 13:51:35 CET 2011


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: set-strategies
Changeset: r49220:94d75f6d8f44
Date: 2011-10-11 14:40 +0200
http://bitbucket.org/pypy/pypy/changeset/94d75f6d8f44/

Log:	when updating empty list simply copy storage and strategy from the
	other set

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
@@ -284,9 +284,8 @@
         w_set.sstorage = w_other.get_storage_copy()
 
     def update(self, w_set, w_other):
-        # XXX wouldn't it be faster to just copy the storage of w_other into self?
-        w_set.switch_to_object_strategy(self.space)
-        w_set.update(w_other)
+        w_set.strategy = w_other.strategy
+        w_set.storage = w_other.get_storage_copy()
 
     def iter(self, w_set):
         return EmptyIteratorImplementation(self.space, w_set)


More information about the pypy-commit mailing list