BUG-4275: Improve MapAdaptor and LazyContainerNode map overhead 30/26630/3
authorRobert Varga <rovarga@cisco.com>
Mon, 7 Sep 2015 19:37:26 +0000 (21:37 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 10 Sep 2015 07:20:23 +0000 (07:20 +0000)
commit38ac687b3965ff80827780fd22979e69003d2186
tree4e59380e624a21a9f066f5a186b8e072e1ad3379
parented6fff67cb0fed454ea6654752f23dc9f914c04d
BUG-4275: Improve MapAdaptor and LazyContainerNode map overhead

Analysis of a heap dump has shown that for two-entry containers we end
up allocating HashMaps with default load factor. This boils down to
HashMap's copy constructor enforcing allocation to at least 16 entries
and also us not properly sizing for small maps.

MapAdaptor is taught to use HashMap.clone() and fall back to conservative
sizing on small inputs.

LazyContainerNode is taught to properly size the copy map when being
converted to a Mutable.

Change-Id: I6ad36aea31aab2e5e70176143d74e97c6d6a9ca5
Signed-off-by: Robert Varga <rovarga@cisco.com>
common/util/src/main/java/org/opendaylight/yangtools/util/MapAdaptor.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/LazyContainerNode.java