[YANGTOOLS-1019] Lazily-instantiated LeafNodes Created: 27/Aug/19  Updated: 24/Sep/19  Resolved: 03/Sep/19

Status: Resolved
Project: yangtools
Component/s: data-impl
Affects Version/s: None
Fix Version/s: 4.0.0

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to YANGTOOLS-490 Create SchemaContext-aware Normalized... Confirmed

 Description   

As noted in YANGTOOLS-490, we should be able to reduce our memory footprint by storing child leaves in a 'naked' format, i.e. we would store only the leaf value and allocate a LeafNode each time it is accessed.

While this can end up putting some pressure on TLAB allocations, an OFP heap dump is showing that retained LeafNodes are costing us ~155MiB out of 855MiB (i.e. 19%) in 6.8 million (21%) objects.

Given that we keep leaves in a Map, we always know the NodeIdentifier of the leaf, i.e. we would have a Map.Entry<NodeIdentifier, Object>, which has all the information needed to reconstruct the leaf.

Some thought needs to be put into NormalizedNode.getValue(), as that currently operates on Map.values() and will have to operate on Map.entrySet().


Generated at Wed Feb 07 20:54:57 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.