You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/08/29 08:27:25 UTC

svn commit: r264090 - /directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DnComparator.java

Author: elecharny
Date: Sun Aug 28 23:27:21 2005
New Revision: 264090

URL: http://svn.apache.org/viewcvs?rev=264090&view=rev
Log:
Add a simple String comparison to greatly improve the ApacheDs performance.

Modified:
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DnComparator.java

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DnComparator.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DnComparator.java?rev=264090&r1=264089&r2=264090&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DnComparator.java (original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DnComparator.java Sun Aug 28 23:27:21 2005
@@ -88,15 +88,23 @@
         }
         else if ( obj1 instanceof String )
         {
-            try
-            {
-                dn1 = parser.parse( ( String ) obj1 ) ;
-            }
-            catch ( NamingException ne )
-            {
-                throw new IllegalArgumentException( 
-                    "first argument was not a distinguished name" ) ;
-            }
+        	// Speedup the comparison
+        	if ( ((String)obj1).compareTo((String)obj2) == 0)
+        	{
+        		return 0;
+        	}
+        	else
+        	{
+	            try
+	            {
+	                dn1 = parser.parse( ( String ) obj1 ) ;
+	            }
+	            catch ( NamingException ne )
+	            {
+	                throw new IllegalArgumentException( 
+	                    "first argument was not a distinguished name" ) ;
+	            }
+        	}
         }
         else
         {