Lower the size of ModifiedNode children maps 28/22428/4
authorRobert Varga <rovarga@cisco.com>
Fri, 12 Jun 2015 01:17:20 +0000 (03:17 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 12 Jun 2015 13:08:00 +0000 (13:08 +0000)
This lowers the default allocation of 16 to 8, hopefully lowering memory
pressure.

Change-Id: I72218f71a4407e0cdd802984b2edaf8fdfe8d3b2
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ModifiedNode.java

index dbb1f419207553fff84da39f3bf5cea54e21634e..6eca344cb5dfefe9630dbaa24078f53a9687bb5c 100644 (file)
@@ -52,6 +52,7 @@ final class ModifiedNode extends NodeModification implements StoreTreeNode<Modif
             throw new IllegalArgumentException(String.format("Unhandled modification type %s", input.getOperation()));
         }
     };
+    private static final int DEFAULT_CHILD_COUNT = 8;
 
     private final Map<PathArgument, ModifiedNode> children;
     private final Optional<TreeNode> original;
@@ -70,10 +71,10 @@ final class ModifiedNode extends NodeModification implements StoreTreeNode<Modif
             children = Collections.emptyMap();
             break;
         case ORDERED:
-            children = new LinkedHashMap<>();
+            children = new LinkedHashMap<>(DEFAULT_CHILD_COUNT);
             break;
         case UNORDERED:
-            children = new HashMap<>();
+            children = new HashMap<>(DEFAULT_CHILD_COUNT);
             break;
         default:
             throw new IllegalArgumentException("Unsupported child tracking policy " + childPolicy);