Rather than checking that one set contains the other set AND vice versa,
I think it will be faster to check that one contains the other and the
two sets have the same size.

OK to commit?

2005-09-27  Anthony Balkissoon  <[EMAIL PROTECTED]>

        * javax/swing/text/SimpleAttributeSet.java:
        (isEqual): Rather than check that each set contains the other, check 
        that one set contains the other and that the sets have the same size.
        This should improve performace.

--Tony
Index: javax/swing/text/SimpleAttributeSet.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/SimpleAttributeSet.java,v
retrieving revision 1.10
diff -u -r1.10 SimpleAttributeSet.java
--- javax/swing/text/SimpleAttributeSet.java	13 Sep 2005 23:44:50 -0000	1.10
+++ javax/swing/text/SimpleAttributeSet.java	27 Sep 2005 18:17:26 -0000
@@ -165,7 +165,8 @@
   {
     return attr != null 
       && attr.containsAttributes(this)
-      && this.containsAttributes(attr);
+      && (this.getAttributeCount() ==
+        attr.getAttributeCount());
   }
     
   public void removeAttribute(Object name)
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to