-
Story
-
Resolution: Done
-
Medium
-
None
-
None
Current layout of SchemaPath favors instantiation of temporary paths and their retention in the object, which means we will end up eating up memory even after we have completed all that is needed. Furthermore we are caching hashCode in the SchemaPath object.
This results in the following layout:
***** 32-bit VM: ********************************************************** org.opendaylight.yangtools.yang.model.api.SchemaPath object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 8 (object header) N/A 8 4 int SchemaPath.hash N/A 12 4 org.opendaylight.yangtools.yang.model.api.SchemaPath SchemaPath.parent N/A 16 4 org.opendaylight.yangtools.yang.common.QName SchemaPath.qname N/A 20 4 com.google.common.collect.ImmutableList SchemaPath.legacyPath N/A Instance size: 24 bytes Space losses: 0 bytes internal + 0 bytes external = 0 bytes total ***** 64-bit VM: ********************************************************** org.opendaylight.yangtools.yang.model.api.SchemaPath object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 16 (object header) N/A 16 4 int SchemaPath.hash N/A 20 4 (alignment/padding gap) 24 8 org.opendaylight.yangtools.yang.model.api.SchemaPath SchemaPath.parent N/A 32 8 org.opendaylight.yangtools.yang.common.QName SchemaPath.qname N/A 40 8 com.google.common.collect.ImmutableList SchemaPath.legacyPath N/A Instance size: 48 bytes Space losses: 4 bytes internal + 0 bytes external = 4 bytes total ***** 64-bit VM, compressed references enabled: *************************** org.opendaylight.yangtools.yang.model.api.SchemaPath object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 12 (object header) N/A 12 4 int SchemaPath.hash N/A 16 4 org.opendaylight.yangtools.yang.model.api.SchemaPath SchemaPath.parent N/A 20 4 org.opendaylight.yangtools.yang.common.QName SchemaPath.qname N/A 24 4 com.google.common.collect.ImmutableList SchemaPath.legacyPath N/A 28 4 (loss due to the next object alignment) Instance size: 32 bytes Space losses: 0 bytes internal + 4 bytes external = 4 bytes total ***** 64-bit VM, compressed references enabled, 16-byte align: ************ org.opendaylight.yangtools.yang.model.api.SchemaPath object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 12 (object header) N/A 12 4 int SchemaPath.hash N/A 16 4 org.opendaylight.yangtools.yang.model.api.SchemaPath SchemaPath.parent N/A 20 4 org.opendaylight.yangtools.yang.common.QName SchemaPath.qname N/A 24 4 com.google.common.collect.ImmutableList SchemaPath.legacyPath N/A 28 4 (loss due to the next object alignment) Instance size: 32 bytes Space losses: 0 bytes internal + 4 bytes external = 4 bytes total
Losing either hash code or the legacy path would improve the situation by 16-25%, making SchemaContext a tad smaller.
- is blocked by
-
YANGTOOLS-761 Remove SchemaNode hashCode()/equals()
- Resolved