[pypy-svn] r39964 - pypy/branch/rope-branch/pypy/objspace/std

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Mar 5 17:45:50 CET 2007


Author: cfbolz
Date: Mon Mar  5 17:45:49 2007
New Revision: 39964

Modified:
   pypy/branch/rope-branch/pypy/objspace/std/rope.py
Log:
optimization for rope equality in the very common case


Modified: pypy/branch/rope-branch/pypy/objspace/std/rope.py
==============================================================================
--- pypy/branch/rope-branch/pypy/objspace/std/rope.py	(original)
+++ pypy/branch/rope-branch/pypy/objspace/std/rope.py	Mon Mar  5 17:45:49 2007
@@ -818,6 +818,9 @@
         return False
     if hash_rope(node1) != hash_rope(node2):
         return False
+    if (isinstance(node1, LiteralStringNode) and
+        isinstance(node2, LiteralStringNode)):
+        return node1.s == node2.s
     iter1 = CharIterator(node1)
     iter2 = CharIterator(node2)
     # XXX could be cleverer and detect partial equalities



More information about the Pypy-commit mailing list