[pypy-commit] pypy default: optimization for the union of two sets using the object strategy
l.diekmann
noreply at buildbot.pypy.org
Tue Jun 19 18:25:06 CEST 2012
Author: l.diekmann
Branch:
Changeset: r55717:452bb2805140
Date: 2012-06-19 18:19 +0200
http://bitbucket.org/pypy/pypy/changeset/452bb2805140/
Log: optimization for the union of two sets using the object strategy
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
@@ -777,6 +777,13 @@
def update(self, w_set, w_other):
d_obj = self.unerase(w_set.sstorage)
+
+ # optimization only
+ if w_other.strategy is self:
+ d_other = self.unerase(w_other.sstorage)
+ d_obj.update(d_other)
+ return
+
w_iterator = w_other.iter()
while True:
w_item = w_iterator.next_entry()
More information about the pypy-commit
mailing list