Use ImmutableOffsetMap for NodeWithKey entries 20/26120/1
authorRobert Varga <rovarga@cisco.com>
Thu, 27 Aug 2015 17:51:50 +0000 (19:51 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 27 Aug 2015 19:59:47 +0000 (21:59 +0200)
commit18106ed2f407f10077bc2a698c2b835fc9a857a4
tree7328cd04a1f6c8feea25a0a0be6c6115ab6448d0
parentee655ecef110165baed51b8926dd7a55792350ca
Use ImmutableOffsetMap for NodeWithKey entries

Number of elements allowed in NodeWithKey equals to the number of leaf
nodes specified in the 'key' statement. It is usually a small number of
elements, but these tend to have many instances.

This patch optimizes memory usage with more than one key leaf. Instead
of an ImmutableMap, in which each instance has its own unique key set,
we use an ImmutableOffsetMap, which shares the key set across all
instances. The cost here is a LoadingCache lookup which should prove
neglible.

Change-Id: I68afe667415ba1eaddbb081b419fedcae4e4b8f7
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/YangInstanceIdentifier.java