-
Improvement
-
Resolution: Done
-
High
-
None
-
None
When we are translating a MapNode into a Map of binding DTOs, we are doing so eagerly and use an ImmutableMap.
This is quite wasteful, as this might entail creating a lot of objects while the caller may want to access only a part of the map.
Create a specialized Map implementation, which will not perform this translation upfront, but rather perform it on demand.
Unfortunately we know very little about what the access pattern is going to be, and there is a number of trade-offs involved. Hence the implementation needs to have a staggered strategy, where it decides how the binding objects are going to be filled. A strategy should be selected on first data access:
- if the first access is Map.values(), the implementation should choose to start populating objects in the iteration order, without indexing them into a Map
- if the first access is Map.keys(), Map.entrySet(), or Map.get(), the implementation should choose to start populating a Map
Switching the initial decision may be problematic and possibly not needed – at least in case of 2) being selected, switching to 1) does not provide much in terms of benefits. Switching to 2) after partially iterating through 1) may prove to be desirable, though.
- is blocked by
-
YANGTOOLS-1101 Add NormalizedNodeContainer.size()
- Resolved