[YANGTOOLS-919] MutableOffsetMap could allocate newKeys lazily Created: 29/Nov/18 Updated: 10/Apr/22 Resolved: 01/Dec/18 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.5, 2.0.14 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
As it stands, every time we allocate a MutableOffsetMap, the (Linked)HashMap is also allocated to hold new key mappings. This is strictly not necessary, as we can allocate this map when there is a need for it. This should have no ill effects, as the class is not thread-safe anyway. Lazy allocation will mean that in case we can satisfy the operations using arrays only (removal, unordered replacements), we will never allocate the map. |