Efficient use of devector as queue or stack.

Open
#299 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Start with the devector implementation and its front- and back-capacity reservation functions; the issue does not name files or tests. Review how capacity is centered today, then define what configurable per-end policies and allocation-free moves should mean for queue- and stack-like use cases. Done means those policies support the described one-ended workloads without wasting capacity.

Written by the indexing model from the issue text.

Description

The current policy of devector is to move the data to the middle of the allocated region whenever capacity is needed on an end.

This results in half of the free capacity being wasted when only one end of the devector is used.

Instead, the policy for free capacity for the devector should be configurable separately for each end.

This would make it easy to provide configurations for contiguous queues.

Additionally, the functions to reserve capacity in the front or back always allocate if space is needed. Instead, if sufficient capacity per the policy is available on the other end, the data could be moved without the new allocation. This is most appropriate for queues which have need of capacity on only one end.

Avoiding problems like this would ideally be done by parameterizing the algorithmic choices of devector into general policies.

Dominant language
C++
Stars
127
Forks
126
Avg merge
18h 53m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/container

All issues in boostorg/container

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.