Skip to content

Deque lacks capacity #308

Open
Open
@glbrntt

Description

@glbrntt

Deque is often used as a buffer. However, you can't always control how much data you accept. In these cases it usually makes sense to reclaim storage space if the capacity grows beyond some limit to avoid holding on to too much memory unnecessarily.

This isn't possible with Deque because its capacity is as an implementation detail.

In this thread @lorentey suggested letting Deque shrink on removal along and adding init(minimumCapacity:persistent:). I think this would be sufficient although as described it has a minor drawback that it wouldn't lazily grow up to a capacity limit.

  • I assume adding capacity is a non-starter based on Deque.md?
  • Has any more thought gone into allowing Deque to shrink automatically on removal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions