[SR-10854] Set/Dictionary should shrink its storage on removals #53244
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 8b7187a761b69b52ef9d4ed0a8edd711
Issue Description:
In its current implementation, Set and Dictionary will never reduce their storage size. This can cause increased memory consumption for long-living Set/Dictionary values.
Change Set and Dictionary to shrink storage after removals if the load factor goes below some predefined minimum.
The (amortized) asymptotic performance of removals must be the same before/after this change.
Storage must never shrink below the capacity reserved by the user. This means that Set and Dictionary instances must start keeping track of any reserved capacity.
This change can be tested by looking at the capacity of the Set/Dictionary after removals.
The text was updated successfully, but these errors were encountered: