mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
18.41.2007 325694f2762f303c4cf229200d76569be722f36e
Make a number of minor changes identified through profiling as potential
performance improvements.
4 files modified
64 ■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/DN2URI.java 9 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java 31 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/Attribute.java 12 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/Entry.java 12 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/DN2URI.java
@@ -674,8 +674,7 @@
     * reverse order we must set the first byte (the comma).
     * No possibility of overflow here.
     */
    byte[] end = suffix.clone();
    end[0] = (byte) (end[0] + 1);
    byte[] end = null;
    DatabaseEntry data = new DatabaseEntry();
    DatabaseEntry key = new DatabaseEntry(suffix);
@@ -692,6 +691,12 @@
             status == OperationStatus.SUCCESS;
             status = cursor.getNextNoDup(key, data, LockMode.DEFAULT))
        {
          if (end == null)
          {
            end = suffix.clone();
            end[0] = (byte) (end[0] + 1);
          }
          int cmp = comparator.compare(key.getData(), end);
          if (cmp >= 0)
          {
opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java
@@ -60,9 +60,6 @@
 */
public class LDAPAttribute
{
  // The set of values for this attribute.
  private ArrayList<ASN1OctetString> values;
@@ -114,14 +111,21 @@
   */
  public LDAPAttribute(Attribute attribute)
  {
    StringBuilder attrName = new StringBuilder(attribute.getName());
    for (String o : attribute.getOptions())
    if (attribute.hasOptions())
    {
      attrName.append(";");
      attrName.append(o);
    }
      StringBuilder attrName = new StringBuilder(attribute.getName());
      for (String o : attribute.getOptions())
      {
        attrName.append(";");
        attrName.append(o);
      }
    this.attributeType = attrName.toString();
      this.attributeType = attrName.toString();
    }
    else
    {
      this.attributeType = attribute.getName();
    }
    LinkedHashSet<AttributeValue> attrValues = attribute.getValues();
    if ((attrValues == null) || attrValues.isEmpty())
@@ -192,14 +196,7 @@
    }
    else
    {
      ArrayList<ASN1Element> valueElements =
           new ArrayList<ASN1Element>(values.size());
      for (ASN1OctetString s : values)
      {
        valueElements.add(s);
      }
      elements.add(new ASN1Set(valueElements));
      elements.add(new ASN1Set(new ArrayList<ASN1Element>(values)));
    }
    return new ASN1Sequence(elements);
opends/src/server/org/opends/server/types/Attribute.java
@@ -176,7 +176,7 @@
    this.attributeType = attributeType;
    this.name          = name;
    if (options == null)
    if ((options == null) || options.isEmpty())
    {
      this.options = new LinkedHashSet<String>(0);
      lowerOptions = options;
@@ -184,7 +184,7 @@
    else
    {
      this.options = options;
      lowerOptions = new LinkedHashSet<String>();
      lowerOptions = new LinkedHashSet<String>(options.size());
      for (String option : options)
      {
        lowerOptions.add(toLowerCase(option));
@@ -193,7 +193,7 @@
    if (values == null)
    {
      this.values = new LinkedHashSet<AttributeValue>();
      this.values = new LinkedHashSet<AttributeValue>(0);
    }
    else
    {
@@ -868,11 +868,7 @@
  public Attribute duplicate(boolean omitValues)
  {
    LinkedHashSet<String> optionsCopy =
         new LinkedHashSet<String>(options.size());
    for (String s : options)
    {
      optionsCopy.add(s);
    }
         new LinkedHashSet<String>(options);
    if (omitValues)
    {
opends/src/server/org/opends/server/types/Entry.java
@@ -52,6 +52,7 @@
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.util.LDIFException;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.loggers.Error.*;
import static org.opends.server.messages.CoreMessages.*;
@@ -581,17 +582,18 @@
      return null;
    }
    AttributeType ocType =
         DirectoryServer.getObjectClassAttributeType();
    LinkedHashSet<AttributeValue> ocValues =
         new LinkedHashSet<AttributeValue>(objectClasses.size());
    for (String s : objectClasses.values())
    {
      ocValues.add(new AttributeValue(new ASN1OctetString(s),
                            new ASN1OctetString(toLowerCase(s))));
      ocValues.add(new AttributeValue(ocType,
                                      new ASN1OctetString(s)));
    }
    return new Attribute(
                    DirectoryServer.getObjectClassAttributeType(),
                    "objectClass", ocValues);
    return new Attribute(ocType, ATTR_OBJECTCLASS, ocValues);
  }