directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r264090 - /directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DnComparator.java
Date Mon, 29 Aug 2005 06:27:25 GMT
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
         {



Mime
View raw message