[pypy-commit] pypy default: these loops are unrolled anyway, directly access the correct attribute instead

cfbolz noreply at buildbot.pypy.org
Fri Nov 4 10:50:17 CET 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: 
Changeset: r48727:6418ef5bfbf7
Date: 2011-11-03 20:09 +0100
http://bitbucket.org/pypy/pypy/changeset/6418ef5bfbf7/

Log:	these loops are unrolled anyway, directly access the correct
	attribute instead of going through a switch again.

diff --git a/pypy/objspace/std/smalltupleobject.py b/pypy/objspace/std/smalltupleobject.py
--- a/pypy/objspace/std/smalltupleobject.py
+++ b/pypy/objspace/std/smalltupleobject.py
@@ -71,7 +71,7 @@
             if self.length() != w_other.length():
                 return space.w_False
             for i in iter_n:
-                item1 = self.getitem(i)
+                item1 = getattr(self,'w_value%s' % i)
                 item2 = w_other.getitem(i)
                 if not space.eq_w(item1, item2):
                     return space.w_False
@@ -82,7 +82,7 @@
             x = 0x345678
             z = self.length()
             for i in iter_n:
-                w_item = self.getitem(i)
+                w_item = getattr(self, 'w_value%s' % i)
                 y = space.int_w(space.hash(w_item))
                 x = (x ^ y) * mult
                 z -= 1


More information about the pypy-commit mailing list