Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-10854] Set/Dictionary should shrink its storage on removals #53244

Open
lorentey opened this issue Jun 7, 2019 · 0 comments
Open

[SR-10854] Set/Dictionary should shrink its storage on removals #53244

lorentey opened this issue Jun 7, 2019 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@lorentey
Copy link
Member

lorentey commented Jun 7, 2019

Previous ID SR-10854
Radar rdar://problem/18114559
Original Reporter @lorentey
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

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.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant