Do not cache path from root 83/87583/5
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 11 Feb 2020 14:09:49 +0000 (15:09 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 11 Feb 2020 17:40:01 +0000 (18:40 +0100)
commit5e085657d0784133fbed731c9c6bb10e10fb4132
treebd5b04d6abc83089728e27b912d188f008c8ca2e
parentc264e41aa2b1510a883150d3c07dfcdb5d82b3d8
Do not cache path from root

Heap analysis shows that full 16% of SchemaContext memory is retained
by SchemaPath instances. We can reduce this by removing path caching,
so that each query to getPathFromRoot() results in a new collection.

This saves a pointer field in the structure, saving 8 bytes in typical
64bit JVM scenarios -- going from 32/48 to 24/40 bytes, saving 16-25%
instance size.

JIRA: YANGTOOLS-1076
Change-Id: I5613764c513b9b54473e2e587de2b8b38713ed15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathFromRoot.java [new file with mode: 0644]
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaPath.java